How to get refresh token in Visual .NET

47 views
Skip to first unread message

adwor...@gmail.com

unread,
Sep 29, 2016, 9:41:34 AM9/29/16
to AdWords API Forum
Hello everyone:

I'm starting with the AdWords API from Visual .NET and have trouble getting the OAuth2RefreshToken. 

I have the rest of the keys but I lack the OAuth2RefreshToken.

On the other hand, I do not know if I get another refresh token during the execution of the application.

If anyone can guide me or tell me a resource where I can find information, I would be very grateful.

Thank you very much

Javier

Shwetha Vastrad (AdWords API Team)

unread,
Sep 29, 2016, 1:10:56 PM9/29/16
to AdWords API Forum
Hi Javier,

Depending on type of authentication flow used in your application, you can follow the articles provided here to generate a refresh token. Once you have populated your configuration file, the client library refreshes expired access tokens automatically.

Regards,
Shwetha, AdWords API Team.

Zweitze

unread,
Sep 30, 2016, 6:47:53 AM9/30/16
to AdWords API Forum
If you develop batch software:

Download the client library sources. In it is a project called OAuth2TokenGenerator (or something like that). It generates an OAuth2 refreshtoken for the Application flow, which is what you want in batch software.
OAuth2TokenGenerator asks for ClientId and ClientSecret, and then shows a web page asking you to log in and confirm that the client accesses AdWords information. When you agree it shows the token.

You can also do this when you develop software where the user does not have to login but always uses a fixed login.

If you develop a website where the user has to login, the above is no help. If you develop software where the end user has to login, this is also no help.

anash

unread,
Sep 30, 2016, 7:46:41 AM9/30/16
to AdWords API Forum
Hi Javier,

If you need to implement a website where users have to login, then you can take a look at https://github.com/googleads/googleads-dotnet-lib/tree/master/examples/AdWords/CSharp/OAuth for an ASP.NET example that does barebones flow. It stores and restores creds from the Session, but a production application needs to do this from a database.

Cheers,
Anash P. Oommen,
AdWords API Advisor.
Reply all
Reply to author
Forward
0 new messages