我正在使用Google文档中的代码。 Link
我的代码是这样的
$client = new Google_Client();
$client->setApplicationName('Google Calendar API PHP Quickstart');
$client->setScopes(Google_Service_Calendar::CALENDAR_READONLY);
$client->setAuthConfig('credentials.json');
$client->setAccessType('offline');
$client->setPrompt('select_account consent');
但是当我运行它时,它给出了一个错误。
400. That’s an error.
Error: invalid_request
Invalid parameter value for prompt: Invalid prompt: select_account consent/calendar
请帮助。
预先感谢。
答案 0 :(得分:1)
如果您检查库的源代码client.php
this.adultPaxIdx = -1;
我认为您不能同时拥有两者,我认为您应该将其设置为另一个
/**
* Set the prompt hint. Valid values are none, consent and select_account.
* If no value is specified and the user has not previously authorized
* access, then the user is shown a consent screen.
* @param $prompt string
*/
public function setPrompt($prompt)
{
$this->config['prompt'] = $prompt;
}
这意味着您正在关注的教程中有一个错误。
我的代码
$client->setPrompt('consent');