I am writing a Java client side application which needs to access the Google tasks API. I am following the instructions from the page https://developers.google.com/accounts/docs/OAuth2InstalledApp and I have managed to get an authorization code. However, when I try to get an access token I keep getting an error 400 "Bad request".
I was testing using the Poster add-on for Firefox. I send a post request to https://accounts.google.com/o/oauth2/token with content:
code=<the-code-i-got-in-step1>&
client_id=1097620474561-gusvm8cq428h86r7pcum285cuffssncj.apps.googleusercontent.com&
client_secret=,my-client-secret>&
redirect_uri=hurn:ietf:wg:oauth:2.0:oob&
grant_type=authorization_code
Any suggestions about what I might be doing wrong?
I eventually figured it out. I was not explicitly specifying offline access was required when making the initial request for a code as described here invalid_grant trying to get oAuth token from google
Thanks to everyone who helped me with this question