我嘗試使用下面的代碼谷歌標誌:無法使用Google+ API
<code>
function gLogin(){ //handle the login process for retrieving google User's email with
$client = new Google_Client();
$client->setAuthConfig(CLIENT_SECRET_PATH);
$client->setScopes(array(Google_Service_Oauth2::USERINFO_EMAIL,Google_Service_Oauth2::USERINFO_PROFILE,Google_Service_Plus::PLUS_ME,Google_Service_Plus::PLUS_LOGIN));
$plus = new Google_Service_Plus($client);
try{
$client->authenticate($_GET['code']);
$me = $plus->people->get('me');
//deal with non-domain Emails
if($me['domain'] !== 'xxx.org' && $me['domain'] !== 'xxx.org'){
$client->revokeToken();
$errorUrl = ERROR_URI . '?error=wrongDomain';
http_response_code(302);
header('Location: ' . $errorUrl);
die();
}
$displayName = $me['displayName'];
//get the email
$oauth = new Google_Service_Oauth2($client);
$emails = $oauth->userinfo->get();
$email = $emails->getEmail();
//too nested, going to sqlLogin
sqlLogin($email, $displayName);
$client->revokeToken();
}catch(Exception $e){
error_log($e->getMessage());
}
}
</code>
當我做,我會收到以下錯誤:
{\n "error": {\n "errors": [\n {\n "domain": "usageLimits",\n
"reason": "dailyLimitExceededUnreg",\n "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",\n
"extendedHelp": " https://code.google.com/apis/console "\n }\n ],\n "code": 403,\n "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."\n }\n}\n,
任何幫助,將不勝感激