I\'m trying to get familiar with the Google Drive API using the official Java sample. However, after wasting a few hours and attempting to set the sample up two times, I\'m
I used the java OAuth code distributed in Google's dredit sample for a program that goes through the "opens with" flow and likewise recieved the 403 error.
I had to dig into the OAuth code to find the problem, the source of which I haven't seen mentioned elsewhere in regard to the 403 error. Essentially the ExchangeCode method of CredentialMediator assumes there is only one redirect uri and this is the one you are hoping to go to. This wasn't the case for me and resulted in a CodeExchangeException.
To resolve you could massage the list of uris in the client_secrets so the uri you wish to redirect to is first or some such, but if this method could go to any one of a number of uris it will need parameterisation.
I hope this helps someone root out their 403 gremlin.