user3325976
user3325976

Reputation: 819

Google API OAuth2.0 bad request invalid_grant

I need my server application to retrieve authentication token from google API (https://accounts.google.com/o/oauth2/token method), but I only get the 400 respnse (Bad request) also returned { "error" : "invalid_grant"}. Here is my request data:

{ ["method"]=> "POST" 
["header"]=> "Content-type: application/x-www-form-urlencoded" 
["content"]=> "client_id={my google client email}&client_secret={my secret code}&grant_type=authorization_code&code={returned temporary token}&redirect_uri=http%3A%2F%2Fwww.lunariumfashion.com%2Fsetup_picasa" } }

I'm using this library for authentication https://github.com/philsturgeon/codeigniter-oauth2, also tried hacking with AJAX, results were similar.

I am stuck here for 24 hours and read everything I've found, please, help!

Upvotes: 0

Views: 2305

Answers (1)

Eugenio Pace
Eugenio Pace

Reputation: 14212

The client_id is not your email. It is the identifier that Google gives you when registering your app. Same with secret.

Follow this instructions (ignore references to auth0 in the doc): https://docs.auth0.com/goog-clientid

Upvotes: 1

Related Questions