我从Android发送令牌并进行此操作:
$mToken = $this->_request['token'];
$userinfo = 'https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=' . $mToken;
$json = file_get_contents($userinfo);
$userInfoArray = json_decode($json,true);
$googleEmail = $userInfoArray['email'];
$tokenUserId = $userInfoArray['user_id'];
$tokenAudience = $userInfoArray['audience'];
$tokenIssuer = $userInfoArray['issuer'];
if ( strcasecmp( $tokenAudience, $GOOGLE_FULL_CLIENT_ID ) != 0) {
error_log ( "ERROR:'" . $tokenAudience . "' did not match." );
}
如何获取用户信息?