Open gezimapi opened 5 years ago
Hi @gezimapi ,
Make sure that your userRefreshCredentials
is an instance of \Google\Auth\Credentials\UserRefreshCredentials
Hope this code snippet helps:
use Edujugon\GoogleAds\Auth\OAuth2;
$oAuth = new OAuth2();
$userRefreshCredentials = $oAuth->userCredentials([
'clientId' => 'XXX',
'clientSecret' => 'XXX',
'refreshToken' => 'XXX'
]);
hi ,
Now it works , i have multiple MCC can I set the clientCustomerId to get only the accounts of one MCC.
Thx in advance
hi i have to tried to list the accounts in my mcc using:
use Edujugon\GoogleAds\GoogleAds; use Google\AdsApi\AdWords\v201809\mcm\CustomerService; use Edujugon\GoogleAds\Session\AdwordsSession;
$adWordsServices = new GoogleAds(); $session = (new AdwordsSession())->buildWithOAuth(config('google-ads.production.developerToken'),$userRefreshCredentials);
$managedCustomerService = $adWordsServices->service(CustomerService::class, $session)->getService(); $page = $managedCustomerService->getCustomers();
i get this response:
Argument 1 passed to Google\AdsApi\AdWords\AdWordsSessionBuilder::withOAuth2Credential() must implement interface Google\Auth\FetchAuthTokenInterface, array given, called in /home/glanaj/projects/neon/vendor/edujugon/laravel-google-ads/src/src/Session/AdwordsSession.php on line 90