Google Api Php Client - Google Auth OAuth 2 -
my code:
if ($client->getaccesstoken()) { $_session['access_token'] = $client->getaccesstoken(); $obj_token = json_decode($client->getaccesstoken()); $accesstoken = $obj_token->access_token; $token_data = $client->verifyidtoken($accesstoken)->getattributes(); } error:
uncaught exception 'google_auth_exception' message 'wrong number of segments in token: ya29.qqh27nhaxvxpj64txbjht_j1fnavcjosyfwufkpgsn9lbiynds7wgdxvdr31y9hvfbm824mrzocrwa'
$accesstoken should string 2 "." don't know why $token_data return a29.qqh27nhaxvxpj64txbjht_j1fnavcjosyfwufkpgsn9lbiynds7wgdxvdr31y9hvfbm824mrzocrwa', have 1 "."
you're trying verify access_token id_token. different tokens, serving different purposes. id_token example see code @ https://github.com/google/google-api-php-client/blob/master/examples/idtoken.php, so:
$token_data = $client->verifyidtoken()->getattributes(); assuming id_token returned google part of handshake in first place.
Comments
Post a Comment