Created
September 13, 2012 18:27
-
-
Save rubyonrailstutor/3716447 to your computer and use it in GitHub Desktop.
google oauth problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Following steps at https://developers.google.com/accounts/docs/OAuth2WebServer | |
Step 1. submit a get request to the google api endpoint, below is example of my (seemingly) correctly formed get request | |
https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https://mail.google.com/+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile&client_id=XXXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=http://localhost:4567/oauth2callback&access_type=online | |
Step 2. receive a callback that contains an authorization code, below is the url I'm receiving back. | |
http://localhost:9393/oauth2callback?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY | |
Step 3. submit a post request to | |
POST /o/oauth2/token HTTP/1.1 | |
Host: accounts.google.com | |
my (seemingly) correctly formed post url | |
https://accounts.google.com/o/oauth2/token?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&client_id=AAAAAAAAAAAA.apps.googleusercontent.com&client_secret=ZZZZZZZZZZZZZZZZZZZZZZZZ&redirect_uri=http://localhost:4567/oauth2callback&grant_type=authorization_code | |
the post url is returning json data | |
{ | |
"error" : "invalid_request" | |
} | |
so I could infer that something is incorrect in my post url. i've tried the post url using the complete code returned in step 2 and also the xxxx portion of the token, which is the format that the google documentation uses. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment