Having issues with oauth token

25 views
Skip to first unread message

Rob Hayes

unread,
Jun 11, 2015, 1:59:47 PM6/11/15
to adwor...@googlegroups.com
I'll see if I can get enough detail in here. Please hit me with questions if I leave something out. I'm trying to move an application from using the ClientLogin to OAuth.

No matter what I do, I always get this error back from the service.
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'&lt;null&gt;']</faultstring>
            <detail>
                <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201502" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201502">
                    <message>[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'&lt;null&gt;']</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthenticationError">
                        <fieldPath/>
                        <trigger>&lt;null&gt;</trigger>
                        <errorString>AuthenticationError.OAUTH_TOKEN_INVALID</errorString>
                        <ApiError.Type>AuthenticationError</ApiError.Type>
                        <reason>OAUTH_TOKEN_INVALID</reason>
                    </errors>
                </ns2:ApiExceptionFault>
            </detail>
        </soap:Fault>

Code wise, all I'm doing is this. Even this I snagged from the example code, just because I wanted to see if something in my existing app was messing with things.
var user = new AdWordsUser();
AdsOAuthProviderForApplications oAuth2Provider = (user.OAuthProvider as AdsOAuthProviderForApplications);
oAuth2Provider.RefreshAccessToken();

ManagedCustomerService managedCustomerService =  (ManagedCustomerService)user.GetService(AdWordsService.v201502.ManagedCustomerService);
Selector selector = new Selector();
selector.fields = new String[] { "CustomerId", "Name" };
ManagedCustomerPage page = managedCustomerService.get(selector);

Configuration wise, I'm set like this. I know it doesn't make much sense, given that I had to blank out so much:
<add key="DeveloperToken" value="xxxxxxxxxxxxxxxxxxxxxx" />
<add key="ClientCustomerId" value="111-111-1111" />
<add key="OAuth2Scope" value="https://www.googleapis.com/auth/adwords" />
<add key='AuthorizationMethod' value='OAuth2' />
<add key='OAuth2ClientId' value='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com' />
<add key='OAuth2ClientSecret' value='xxxxxxxxxxxxxxxxxxxxxxxx' />
<add key='OAuth2RefreshToken' value='1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' />
<add key="OAuth2Mode" value="APPLICATION" />

I used the OAuthTokenGenerator to generate the info using the email address for the MCC.
Reply all
Reply to author
Forward
0 new messages