Hello,

I believe this error message means that the refresh token you're using 
isn't actually associated with AdWords. There is an alternate way to fetch 
refresh tokens for AdWords compared to other Google products. Since it 
seems you are using the .NET library, I suggest checking out the OAuth2 
examples 
<https://github.com/googleads/googleads-dotnet-lib/tree/master/examples/AdWords/CSharp/OAuth>
 
folder for that library, which contains code examples for various OAuth2 
use cases, including fetching the refresh token.

Regards,
Mike, AdWords API Team

On Thursday, February 5, 2015 at 2:20:50 PM UTC-5, [email protected] wrote:
>
> Hi Michael,
>
> Thanks for getting back to me with a reply. 
>
> I generated a new refresh token from the OAuth Playground against this API:
>
> https://adwords.google.com/api/adwords
>
> I'm testing with the AdWords test project from GitHub and popped this in 
> the app.config:
>
> <add key="ClientCustomerId" value="111-222-3333"/>
>
> <add key="OAuth2ClientId" value="444-xxx.apps.googleusercontent.com" />
>
> <add key="OAuth2ClientSecret" value="yyy" />
>
> <add key="OAuth2RefreshToken" value="1/zzz" />
>
> I ran the TestGetCampaignsCSharpExample unit test and got this error:
>
> Test Name: TestGetCampaignsCSharpExample
> Test FullName: 
> Google.Api.Ads.AdWords.Tests.v201409.BasicOperationsTest.TestGetCampaignsCSharpExample
> Test Source: 
> c:\googleads-dotnet-lib-master\tests\AdWords\v201409\BasicOperationsTest.cs 
> : line 245
> Test Outcome: Failed
> Test Duration: 0:00:01.372
>
> SetUp : Google.Api.Ads.Common.Lib.AdsOAuthException : Failed to refresh 
> access token.
> {
>   "error" : "unauthorized_client"
> }
>
> Initially I tried this approach assuming that I the API would need a 
> different token, but the error message suggested to me that I should use 
> the same DFA token and was actually encouraged by the expiration message. I 
> hoped that the client authorization was successful.
>
> With another attempt and a new refresh token, I called the 
> RefreshAccessTokenIfExpiring() method and passed the access token, which 
> resulted in this exception:
>
> 'Google.Api.Ads.AdWords.Lib.AdWordsCredentialsExpiredException' 
>
> When the method is not called, the API returns this message:
>
>   "error" : "unauthorized_client"
>
> My experience using OAuth with Google is limited to DFA. Please let me 
> know what I'm missing with the above and I'll make the world right.
>
> Regards
>
>
> On Tuesday, February 3, 2015 at 12:01:37 PM UTC-8, Michael Cloonan 
> (AdWords API Team) wrote:
>>
>> Hello,
>>
>> You must use a new refresh token with AdWords, as each refresh token 
>> allows for usage of a specific service as a specific account. This is a 
>> security measure; you shouldn't be able to use your DFA refresh token for 
>> AdWords because you only authenticated the usage of DFA.
>>
>> Make sure to generate your refresh token when logged into the MCC 
>> account. If you're still having difficulties after doing that, please 
>> include the full error message you get when trying to make a request with 
>> your new refresh token.
>>
>> Regards,
>> Mike, AdWords API Team
>>
>> On Monday, February 2, 2015 at 5:26:03 PM UTC-5, [email protected] wrote:
>>>
>>> Hi,
>>>
>>> I'm working on integrating a DFA refresh token with the AdWords service 
>>> in a C# project. The WebConfig contains these key/values:
>>>
>>> <add key="OAuth2ClientId" value="XXX.apps.googleusercontent.com" />
>>>
>>> <add key="OAuth2ClientSecret" value="YYY" />
>>>
>>> <add key="OAuth2RefreshToken" value="1/ZZZ" />
>>>
>>>
>>> which are the same as used with DFA. When I attempt a request from 
>>> AdWords, though, an exception is thrown:
>>>
>>>
>>> 'Google.Api.Ads.AdWords.Lib.AdWordsCredentialsExpiredException'
>>>
>>>
>>> I tried a similar request using the AdWords test solution form GitHub 
>>> and go the same results. My current DFA project continues to work fine with 
>>> these credentials.
>>>
>>>
>>> Also, I generated a new refresh token from the OAuth 2.0 Playground 
>>> using the same account, but got an unauthorized account message when 
>>> attempting to query the AdWords service. I only did this to test my code 
>>> and would prefer to use just one token for both services.
>>>
>>>
>>> I can't find a solution using the normal methods, so I can any help you 
>>> throw my way would be really appreciated.
>>>
>>>
>>> Thanks!
>>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/786d21e5-77e8-4d0f-b687-1ba08b7ccc6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to