Hi,
I am using google ads api to get adwords data, but I got an error when I
execute the code.
```
$oAuth2Credential = (new
OAuth2TokenBuilder())->fromFile("google_ads_php.ini")->build();
// OAuth2 credentials above.
$googleAdsClient = (new
GoogleAdsClientBuilder())->fromFile("google_ads_php.ini")
->withOAuth2Credential($oAuth2Credential)
->build();
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$customerServiceClient = $googleAdsClient->getCustomerServiceClient();
// Issues a request for listing all accessible customers.
$accessibleCustomers = $customerServiceClient->listAccessibleCustomers();
print 'Total results: ' . count($accessibleCustomers->getResourceNames()) .
PHP_EOL;
```
Error:
```
{ "message": "Request is missing required authentication credential.
Expected OAuth 2 access token, login cookie or other valid authentication
credential. See
https:\/\/developers.google.com\/identity\/sign-in\/web\/devconsole-project.",
"code": 16, "status": "UNAUTHENTICATED", "details": [ { "@type":
"google.ads.googleads.v6.errors.googleadsfailure-bin", "data": "<Unknown
Binary Data>" }, { "@type": "grpc-status-details-bin", "data": "<Unknown
Binary Data>" }, { "@type": "request-id", "data": "feAcN0Pr2ap5iWrpDaC-rA"
} ] }
```
After learning, someone said that it could be the wrong refresh token, but
I can use the refresh token to refresh access token.
How can I solve it?
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/3c4c5266-b938-482e-a236-082a10953ea7n%40googlegroups.com.