Google Business API回应问题

时间:2018-12-10 08:13:20

标签: php api codeigniter

我正在使用Google Business API,并且验证范围不足。以下是请求Google Business API时出现的错误

{
    "error": {
        "code": 403,
        "message": "Request had insufficient authentication scopes.",
        "status": "PERMISSION_DENIED"
    }
}

我正在使用Codeigniter PHP Framework。这是我用来获取访问令牌的代码

require_once APPPATH . 'libraries/vendor/autoload.php';
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->addScope("https://www.googleapis.com/auth/drive");
$client->addScope("https://www.googleapis.com/auth/plus.business.manage");
$client->setAccessType('offline');
$client->addScope("email");
$client->addScope("profile");
$client->authenticate($_REQUEST['code']);
$accet = $client->getAccessToken();
$access_token = json_decode($accet)->access_token;

然后我要处理访问令牌并发送给Business API并收到该错误。

谢谢。

0 个答案:

没有答案