Stored client's refresh token after access grant, but how do I use it later?

20 views
Skip to first unread message

rentca...@gmail.com

unread,
Dec 12, 2016, 3:05:21 PM12/12/16
to AdWords API Forum
Hi
My web application asks clients to move their MCCs under my account so that the web app can manage the account.  To do so, I want to send and accept a merge invitation of the account.

The client will be asked to give our app access to their account, and I am given an Auth Code.

Using the AuthCode, I call 

oAuth2Provider.FetchAccessAndRefreshTokens(AuthCode)

And then store the resulting refresh token with their client customer id.

I then want to use that refresh token hours later to make the API calls that will send and accept the invitation.  How do I request a new Access Token given the stored Refresh Token?  I am not storing the client's account client_secret, just the refresh token and Client Customer Id.

i have tried:

    oAuth2Provider.RefreshToken = RefreshToken
        oAuth2Provider.RefreshAccessToken()

but this doesn't work.

Thanet Knack Praneenararat (AdWords API Team)

unread,
Dec 13, 2016, 3:22:38 AM12/13/16
to AdWords API Forum
Greeting!

I guess you're using our Google Ads DotNet client library.
If this is not true, please correct me.

I'm not the author of this library but from what I read its code, it seems the oAuth2Provider that you mentioned is an object of the AdsOAuthProviderForApplications interface.
This interface in turn implements the AdsOAuthProvider interface, which contains the getter method of AccessToken.
So, my assumption is we should be able to retrieve access token, via oAuth2Provider.getAccessToken().

Could you please try and let me know if it works for you?

Best,
Thanet, AdWords API Team
Reply all
Reply to author
Forward
0 new messages