【问题标题】:400 - An error has occurred. Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'400 - 发生错误。刷新 OAuth2 令牌时出错,消息:'{ "error" : "invalid_grant" }'
【发布时间】:2013-10-29 16:56:54
【问题描述】:

我升级了我的应用程序,它有一个谷歌融合表,它似乎可以在我的笔记本电脑上运行,所以一旦我完成了,我升级了我的网站,但我得到了无效的授权

所以我为我的网站创建了新的服务帐户和新的服务器应用程序密钥。但我不断收到同样的错误。我读过一些关于删除我的客户端密码的内容,但这仅适用于我正在使用服务帐户的 Web 应用程序。

我还能做什么。

这就是我的连接方式。

$client = new Google_Client();
        $client->setApplicationName("API Project");
        $client->setClientId(CLIENT_ID);

        // Set your cached access token. Remember to replace $_SESSION with a
        // real database or memcached.
        if (isset($_SESSION['token'])) {
            $client->setAccessToken($_SESSION['token']);
        }

        $key = file_get_contents(KEY_FILE);

        $client->setAssertionCredentials(new Google_AssertionCredentials(
                SERVICE_ACCOUNT_NAME,
                array('https://www.googleapis.com/auth/fusiontables'),
                $key)
        );

        //$client->authenticate();

        if ($client->getAuth()->isAccessTokenExpired()) {
            $client->getAuth()->refreshTokenWithAssertion();
        }

        if ($client->getAccessToken()) {
            $_SESSION['token'] = $client->getAccessToken();
        }


        $token = $_SESSION['token'];

        var_dump($token);

        return $token;

【问题讨论】:

    标签: php google-fusion-tables google-api-php-client


    【解决方案1】:

    该死的dreamhost,服务器是15分钟后的未来。学习使用ntp的人。我检查的最后一件事是dreamhost 上的服务器时间。希望他们能在我打开支持票后解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-28
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 2021-09-11
      • 2015-09-17
      • 1970-01-01
      相关资源
      最近更新 更多