Hi guys,
I'm trying to connect customer accounts to web server in php.
First I creating client with my app. Getting refresh/access token. Save 
them to DB.
After that I'm trying to get report, unsuccessfuly.
I'm getting customer credentials via

$client = new Google_Client();
$client->setAccessType("offline");
$client->setAuthConfig('client.json');
$client->addScope("https://www.googleapis.com/auth/adwords";);
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . 
'/api/connect/adwords.php');

$client->fetchAccessTokenWithAuthCode($_GET['code']);

$clientId = $client->getClientId();
$clientSecret = $client->getClientSecret();
$accessToken = $client->getAccessToken();
$refreshToken = $client->getRefreshToken();
//STORE TO DB


After that my code is:

$reportSettings = (new \Google\AdsApi\AdWords\ReportSettingsBuilder())
    ->includeZeroImpressions(false)
    ->skipColumnHeader(false)
    ->skipReportHeader(true)
    ->skipReportSummary(true)
    ->build();

$credentials = (new \Google\AdsApi\Common\OAuth2TokenBuilder())
    ->withClientId($client_id)
    ->withClientSecret($client_secret)
    ->withRefreshToken($refresh_token)
    ->build()
;

$session = (new \Google\AdsApi\AdWords\AdWordsSessionBuilder())
    ->withDeveloperToken("app_dev_token")
    ->withClientCustomerId("app_customer_id")
    ->withUserAgent("app_agent")
    ->withOAuth2Credential($credentials)
    ->withReportSettings($reportSettings)
    ->build()
;
$reportDownloader = new 
\Google\AdsApi\AdWords\Reporting\v201705\ReportDownloader($session);



-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/d63c2fbe-9c1e-4e15-bae3-a4c478b5c39c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Authorizatio... Dimitar Hristonev
    • Re: Aut... 'Dhanya Sundararaju (AdWords API Team)' via AdWords API Forum

Reply via email to