Khushboo
Khushboo

Reputation: 3163

Android OAuth 2.O Unable to retrieve Access Token

I am trying to use Google Calendar API from Android client. I have opted OAuth 2.0 for Installed Apps instead of Account Manager for some reasons.
https://developers.google.com/accounts/docs/OAuth2InstalledApp

I have registered my application on Developer API Console and hence I have client_id and redirect uri. The console does not show client_secret.

I have recieved Authorization code from the google server which is 4/XdlW5dvFW3OWCnKdeG8yDOOjYGAw

https://accounts.google.com/o/oauth2/token?
code=4/XdlW5dvFW3OWCnKdeG8yDOOjYGAw&
client_id=54957922365-fjaa2quhukho8sr5bkpkoq8038vdjh9m.apps.googleusercontent.com&
redirect_uri=urn:ietf:wg:oauth:2.0:oob&
grant_type=authorization_code

If I make this HTTPS URL with the mentioned parameters, I recieve 405 Error Method not allowed in my code. As specified in the URL above, I have added the parameters but am not able to exchange the auth code with access token. Does anyone has any idea why I am not getting access token while I am able to retrieve authorization code?

Upvotes: 2

Views: 1195

Answers (1)

Khushboo
Khushboo

Reputation: 3163

Thanks for the code snippet but I was not posting the link on browser, I have written proper android HTTPS code in Android Project. Just for the reference I shared the url. I have solved this issue. To help other developers, I am attaching the code: https://github.com/misskhushboo/Code-Snippets.git

Upvotes: 1

Related Questions