php - Wrong number of segments in token (Refresh Token) -


the problem when request refresh token https://www.googleapis.com/auth/analytics.readonly , run

$client->refreshtoken(<token>);  $client->verifyidtoken(); 

it returns error

("wrong number of segments in token").

the strange thing when request refresh token array

('https://www.googleapis.com/auth/analytics.readonly','https://www.googleapis.com/auth/plus.login')  

it works charm.

code:

$client->setscopes(array('https://www.googleapis.com/auth/analytics.readonly','https://www.googleapis.com/auth/plus.login')); $client->setrequestvisibleactions('http://schema.org/addaction'); $client->setaccesstype('offline'); $client->setapprovalprompt('force'); 

can offer explanation?

i check <token> set to. guess its set nothing because analytics.readonly not valid scope. 'https://www.googleapis.com/auth/analytics.readonly' valid scope because that's pure url scope.

if using php client library should adding scope

$client->addscope(google_service_analytics::analytics_readonly); 

hello analytics php tutorial


Comments