How to handle urn:ietf:wg:oauth:2.0:oob redirect in Google Calendar API Authorization

theflyingwolves picture theflyingwolves · Oct 31, 2013 · Viewed 16.3k times · Source

I am currently working on a installed desktop application implemented in java. I intend to integrate Google Calendar API into the application.

During the authorization procedure, I come to this stage where I am able to get the authorization code only through triggering a browser where the user consent page is displayed. Users then have to click "accept" and will be redirected to a webpage where the authorization code is presented. Users are to copy this code to the Eclipse System.in in order for the authorization process to continue (to exchange the authorization code for a TokenResponse).

My question is that how can I simplify this process so that the user won't have to do this stupid copy-and-paste stuff for the authorization code to be received? (This won't work anyway, if the project is compiled into a jar file...) Currently all I know is that I will need to provide a callbackurl or something, I just can't figure this out. Therefore, I would appreciate a more concrete answer, rather than simply tell me the concepts.

Thanks in advance.

Answer

Adam Arold picture Adam Arold · Mar 20, 2014

You have to use a service account (which comes with a private key) in order to skip the step involving user interaction. There is a detailed guide about this here.