api - Google_Client()->authenticate($code) error invalid_grant php -
First of all, please forgive me of my English, very bad ... my question is, what should be the criteria of the law? ($ Code) "Google_Client of the class" I wrote the email address of the client ID for web applications; Next I wrote the client ID, and always returned the error 'invalid_grant'
this error is [Error] [Client 127.0.0.1] [Error] [Client 127.0.0.1] PHP Fatal Error: Error 'Google_Auth_Exception' with error 'OAuth2 Access Token; error in fetching message:' invalid_grant '' / var / www ' /Repartos/Google/Auth/OAuth2.php:124 Stop Trace: \ n # 0 /var/www/Repartos/Google/Client.php(136): Google_Auth_OAuth2- & gt; Certify ('4991232 88166 @ d ... ') \ n # 1 /var/www/Repartos/index.php(36): Google_Client- & gt; Certify (' 499123288166 @D ... ') \ n # 2 {main} \
This is my code
Enter your code here set asset token ($ _ session ['slave_acco']); } else {// patent total al $$ client- & gt; SetAccessToken ($ cliente-> Authentication ('$ code')); $ _SESSION ['clave_acceso'] = $ client- & gt; GetAccessToken (); } Tux !!!!!!!
i think you need to get the value from $ _GET ['code'] - response from Google server .
From phpdoc: / ** * Code for a valid authentication token to try the exchange * wrapped around the supportive OAuth 2.0 implementation. * * @complete $ code string code accounts.google.com * @ Return refund token * / Public Function certify ($ code) {$ this- & gt; Certified = true; $ The-> getAuth () - & gt; Authenticate ($ code) return; }
Comments
Post a Comment