Closed GoogleCodeExporter closed 9 years ago
That error is due to the client ID not matching the one the code was requested
for. Make sure you have configured you client ID before calling authenticate.
Original comment by ianbar...@google.com
on 22 Mar 2013 at 4:49
i ma having the same problem..plz tell me how to get rid off this problem
Original comment by parveen...@gmail.com
on 27 Oct 2014 at 7:38
I got the same problem too.
Fatal error: Uncaught exception 'Google_AuthException' with message 'Error
fetching OAuth2 access token, message: ''' in
/home/rodabagu/public_html/google/google2/src/auth/Google_OAuth2.php:113 Stack
trace: #0 /home/rodabagu/public_html/google/google2/src/Google_Client.php(131):
Google_OAuth2->authenticate(Array, '4/nn_lPl2CNFakY...') #1
/home/rodabagu/public_html/google/google2/index.php(46):
Google_Client->authenticate('4/nn_lPl2CNFakY...') #2 {main} thrown in
/home/rodabagu/public_html/google/google2/src/auth/Google_OAuth2.php on line 113
Original comment by binoto8...@gmail.com
on 26 Nov 2014 at 4:45
i got too the same..... pls help me............
Original comment by 3.45am2...@gmail.com
on 27 Nov 2014 at 8:38
had same issue . fixed it by deleting the extra space from the client secret.
when u copy it from google api console you get an extra space.
Original comment by luck...@gmail.com
on 15 Dec 2014 at 12:14
hwo to sort this error!....none of the above solutions help
Original comment by abhinavb...@gmail.com
on 6 Jan 2015 at 8:19
copying client id again resolved it for me. Such a waste of time..
Original comment by govind.c...@gmail.com
on 8 Jan 2015 at 6:41
here is the working code
require_once 'src/Google/Client.php';
error_reporting(-1);
session_start();
$client = new Google_Client();
$client->setApplicationName('P');
$client->setClientId('373253997411-0i5gu266sdg06ie1dn8vq05r774laa2246.apps.googl
eusercontent.com');
$client->setClientSecret('1234hjghghhghgx55ai');
$client->setRedirectUri('http://myserver.net/google/authenticate.php');
$client->setScopes('https://www.googleapis.com/auth/content');
$merchantId = '1993090';
if (isset($_SESSION['oauth_access_token'])) {
$client->setAccessType('offline');
$client->setAccessToken($_SESSION['oauth_access_token']);
} elseif (isset($_GET['code'])) {
$client->setAccessType('offline');
$token = $client->authenticate($_GET['code']);
$_SESSION['oauth_access_token'] = $token;
} else
header('Location: ' . $client->createAuthUrl());
require_once 'src/Google/Service/ShoppingContent.php';
Original comment by govind.c...@gmail.com
on 8 Jan 2015 at 6:44
As per the openid connect spec the workflow should go like this and i was
getting the same error for a while, if anything is different at any one point
you will receive the aforementioned error.
Client clicks the button and then they are redirected to authorization page
(client to server)
Client is then redirected back with a code (client to server)
This code is exchanged with the openid server (server to server)
The server responds with an openid credentials (server to server)
The code that is being exchanged at point 3 will check to see whether you are
using the same credentials to authorize the application as you started with,
this is the main area where you will receive errors if any.
step 1 will be where the first check takes place so it could also error there :)
This is the very simplistic explanation but it gives you an idea where to start
diagnosing the problem.
The issue i had is that i was sending a redirect to the wrong end of my
application (having a testing and a production side) thus the credentials were
wrong and the client wasn't authorized to access the application even if the
credentials were correct :P.
Thanks again,
Steve p.
Original comment by clientre...@reflex.london
on 3 Mar 2015 at 3:07
Original issue reported on code.google.com by
niladrid...@gmail.com
on 22 Jan 2013 at 9:21