CustomerService. OAUTH_TOKEN_INVALID. Please help.

56 views
Skip to first unread message

fmvs...@gmail.com

unread,
Apr 23, 2015, 7:48:07 AM4/23/15
to adwor...@googlegroups.com
I want to get CustomerID.
$customerService = $user->GetService('CustomerService');
$customer = $customerService->get();

Return OAUTH_TOKEN_INVALID, but $OAuth2Handler->IsAccessTokenValid($oauth2Info)return true. Why do i see this error? 

Josh Radcliff (AdWords API Team)

unread,
Apr 23, 2015, 8:34:50 AM4/23/15
to adwor...@googlegroups.com
Hi,

It sounds like you may not have configured your auth.ini file correctly. Please go through the steps listed in the Getting Started section of the README, and check out the library's detailed page on OAuth.

Thanks,
Josh, AdWords API Team

fmvs...@gmail.com

unread,
Apr 23, 2015, 12:40:33 PM4/23/15
to adwor...@googlegroups.com

$user = new AdWordsUser();

$OAuth2Handler = $user->GetOAuth2Handler();

$user->SetOAuth2Info(

    $OAuth2Handler->GetAccessToken(

        $user->GetOAuth2Info(), $code, $redirectUri));

$oauth2Info = $user->GetOAuth2Info();


Debugger::dump($oauth2Info);

$customerService = $user->GetService('CustomerService');

$customer = $customerService->get();

It is part of a code. As you see in the beginning information for authorization is requested at the beginning and behind that directly there is a request. Thus correct access_token and refresh_token values return. And when a request of get is sent application returns OAUTH_TOKEN_INVALID error. If there was an error in auth.ini that the method OAuth2Handler->GetAccessToken () would return incorrect information.


четверг, 23 апреля 2015 г., 17:34:50 UTC+5 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Apr 23, 2015, 1:21:24 PM4/23/15
to adwor...@googlegroups.com
Hi,

Could you generate a new access token from your refresh token, and append the access token to the end of the following URL?


This will take you to a page that displays the state of the access token and its scope. Could you confirm that the scope displayed matches the expected scope documented here?

Thanks,
Josh, AdWords API Team

fmvs...@gmail.com

unread,
Apr 23, 2015, 1:47:14 PM4/23/15
to adwor...@googlegroups.com
Your response helped. Now API returns an error of "Terms and conditions aren't signed". What does it mean?

четверг, 23 апреля 2015 г., 22:21:24 UTC+5 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Apr 23, 2015, 6:14:12 PM4/23/15
to adwor...@googlegroups.com
Hi,

That means that you have not signed terms and conditions on the MCC account that has your developer token. Please see this section of our Common Errors guide for instructions on how to resolve this error.

Thanks,
Josh, AdWords API Team

Reply all
Reply to author
Forward
0 new messages