Authorization using refresh token[ Edited ]
May 2016 - last edited May 2016 by Terry W
I am having refresh token, client_id, client_secret and developer_token. I want to initialize an instance of Mybusiness class using these above information. Is it possible to do so using gmb's java client library. I tried navigating the documentation on oauth/gmb, but could not find a way.
Can anybody give me reference to document/code where this is being done?
Re: Authorization using refresh token
Hi @Siddharth M,
There’s a guide on our API documentation website for setting up the Java Client Library.
When you have an OAuth 2.0 client ID for authentication and authorization, you should use the OAuth 2.0 installed application flow and persist the refresh token. This way, your application will always be able to request a new access token when necessary. This process requires a user to manually authorize the application during the OAuth 2.0 installed applications flow only once.
If you use the access_type=offline parameter during the authorization code flow, you can retain a long-lived refresh token, which is typically received along with the access token. If you are using our Java sample app, the following is a Java code snippet for persisting the refresh token:
// set up authorization code flow
GoogleAuthorizationCodeFlow flow =
return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
I hope this helps get you started.