我剛剛下載了最新的Google API PHP,我試着用「使用Google登錄」腳本進行測試。該API引發此異常顯然是未捕獲:Google API PHP:createAuthURL()上的未捕獲異常?
Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'No scopes specified' in /home/rlcoachi/public_html/hidden/googlelogin/src/Google/Client.php:178 Stack trace: #0 /home/rlcoachi/public_html/hidden/googlelogin/src/Google/Client.php(237): Google_Client->prepareScopes() #1 /home/rlcoachi/public_html/hidden/googlelogin/api.php(76): Google_Client->createAuthUrl() #2 {main} thrown in /home/rlcoachi/public_html/hidden/googlelogin/src/Google/Client.php on line 178
線74-77我api.php
腳本是:
else
{
//For Guest user, get google login url
$authUrl = $gClient->createAuthUrl();
}
gClient是這一直是安裝有ID,祕密,URL一個Google_Client對象,關鍵
請編輯您的答案,以添加關於您的代碼如何工作的說明以及它如何解決OP的問題。許多SO海報是新手,不會理解你發佈的代碼。 –