How can I retrieve the authorization code dynamically?

77 views
Skip to first unread message

demo.wonde...@gmail.com

unread,
Feb 7, 2017, 11:04:01 AM2/7/17
to AdWords API Forum

Hi at all,

this is a code for retrieve the authorizeUrl:


GoogleAuthorizationCodeFlow authorizationFlow = new GoogleAuthorizationCodeFlow.Builder(new NetHttpTransport(),new JacksonFactory(),clientSecrets,SCOPES)

.setApprovalPrompt("auto")

.setAccessType("offline"// Set the access type to offline so that the token can be refreshed.

.build();


String authorizeUrl = authorizationFlow.newAuthorizationUrl().setRedirectUri(CALLBACK_URL).build();


I copy url "authorizeUrl"into browser e copy / paste the authorizationCode.


How can I retrieve it dynamically? This operation can be made "trasparent" to the user?


Thank you so much


Shwetha Vastrad (AdWords API Team)

unread,
Feb 7, 2017, 3:16:42 PM2/7/17
to AdWords API Forum
Hi,

Once you have the authorization request URL, you can direct the user to this URL as shown here and the authorization code will be returned in the response if the user approves the request. You can exchange this authorization code for a refresh token and use this token to generate access tokens when necessary. This type of OAuth flow can be used with web app type credentials

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages