【发布时间】:2018-05-18 07:42:47
【问题描述】:
我正在尝试使用我从 Google Developers Playground (OAuth 2.0) 获得的令牌 ID 创建一个返回 google 用户配置文件的 API。我已阅读并遵循指南,但是当我尝试使用我的代码时,它显示id_token must be passed in or set as part of setAccessToken。这是我的代码:
$id_token = $this->input->post('id_token');
$id_event = $this->input->post('id_event');
$client = new Google_Client(['client_id' => GOOGLE_CLIENT_ID]);
$payload = $client->verifyIdToken($id_token); //It's error here
起初它运行良好,但当我尝试再次运行它时,出现错误。我该怎么办?
这是完整的错误信息:
Type: LogicException
Message: id_token must be passed in or set as part of setAccessToken
Filename: D:\XAMPP\htdocs\api\application\vendor\google\google-api-php-client\src\Google\Client.php
Line Number: 702
Backtrace:
File: D:\XAMPP\htdocs\api\application\controllers\C_android_api.php
Line: 190
Function: verifyIdToken
File: D:\XAMPP\htdocs\api\index.php
Line: 315
Function: require_once
【问题讨论】:
标签: php oauth-2.0 google-oauth