Uncaught exception in Google authentication in apiOAuth2.php and apiOAuth2->setAccessToken('{? "access_tok...') error
In this google+ api there is main poblem when ever you use api code it shows some uncaught error.
like : apiOAuth2->setAccessToken('{? "access_tok...')
Or
and it will not work on localhost
in ..src/auth/apiOAuth2.php file you have the code
If you will check the value of $accessToken['refresh_token'], you will found that
server did not return any value for $accessToken['refresh_token'];
so i use a way, like I don't know what is refresh_token made for I added this line :
copy and paste this code before above code and upload this file on fine
it will work fine.
like : apiOAuth2->setAccessToken('{? "access_tok...')
Or
Fatal error: Uncaught exception 'apiAuthException' with message 'Invalid token format' in /home/project/public_html/gplus/src/auth/apiOAuth2.php:109 Stack trace: #0 /home/project/public_html/gplus/src/auth/apiOAuth2.php(74): apiOAuth2->setAccessToken('{? "access_tok...') #1 /home/project/public_html/gplus/src/apiClient.php(130): apiOAuth2->authenticate(Array) #2 /home/project/public_html/gplus/gplus_login.php(15): apiClient->authenticate() #3 /home/project/public_html/gplus/index.php(9): include('/home/project/...') #4 {main} thrown in /home/project/public_html/gplus/src/auth/apiOAuth2.php on line 109
and it will not work on localhost
in ..src/auth/apiOAuth2.php file you have the code
$accessToken = json_decode($accessToken, true);
if (! isset($accessToken['access_token']) || ! isset($accessToken['expires_in']) || ! isset($accessToken['refresh_token'])) {
throw new apiAuthException("Invalid token format");
}
If you will check the value of $accessToken['refresh_token'], you will found that
server did not return any value for $accessToken['refresh_token'];
so i use a way, like I don't know what is refresh_token made for I added this line :
if (!isset($accessToken['refresh_token'])) $accessToken['refresh_token'] = 12345678910;
copy and paste this code before above code and upload this file on fine
it will work fine.
Comments
Post a Comment