How should I redirect a user to redirect uri without 404error? (OAuth 2.0/Google)

688 views Asked by At

I try to log in google by using OAuth 2.0. I learned that when my app redirect a user to authorization page, I must post "client secret" "scope" and "redirect uri in order to use after user authorize my app.

But......when I click the Authorization Button after logging in a existed google account, the error like "com.google.HTTPStatus error 404" occurs.

I used.....

● Client ID:the one I received from Google Apis Console.

● Client Secret:the one I received from Google Apis Console.

● scope:@"http://www.google.com/reader/api/"

● redirect url:urn:ietf:wg:oauth:2.0:oob

● AuthURL: @"https://accounts.google.com/o/oauth2/auth"

● tokenURL:@"https://accounts.google.com/reader/api/

※My code is exactly like this:http://stackoverflow.com/questions/13173406/what-redirect-uri-should-i-use-oauth-2-0

What kind of possibility is there? (except I used wrong URL) or Did I used wrong one? Please give me an advice. Thanks.

1

There are 1 answers

2
OhadR On

Before we try to pinpoint the issue - have you tried to have a look in Google's oAuth 2.0 Playground? It might be helpful. There, you can find they strongly recommend to use THEIR libraries for client's implementation. And I guess you use C# (.Net), so they have a link there that might be relevant to you...

Anyways, the request for exchanging the auth-code with a token looks like this:

POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
code= & redirect_uri= & client_id=<> & scope= & client_secret=**** & grant_type=authorization_code

I believe that will work for you.

link: their DOCS