Are you sure this is not possible? Because Wordstream actually does this 
job. When you log in to them with your Google Ads account, they can manage 
your campaigns.

Actually, I succeeded partially in the link below, but for some reason I 
cannot get access to the account. Where is my fault I'm trying to figure it 
out.

Link: https://panel.adresgezgini.com/common/functions/

Code: 

require 'google-api/vendor/autoload.php';
use Google\Auth\OAuth2;
use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201809\cm\CampaignService;
use Google\AdsApi\Common\OAuth2TokenBuilder;

session_start();
$oauth2 = new OAuth2([
'authorizationUri' => 'https://accounts.google.com/o/oauth2/v2/auth',
   'tokenCredentialUri' => 'https://www.googleapis.com/oauth2/v4/token',
   'redirectUri' => 'XXXXX',
   'clientId' => 'XXXXXX,
   'clientSecret' => 'XXXXX',
   'scope' => 'https://www.googleapis.com/auth/adwords',
   'refresh_token' => XXXXX'
]);
if(!isset($_GET['code'])){
$oauth2->setState(sha1(openssl_random_pseudo_bytes(1024)));
$_SESSION['oauth2state'] = $oauth2->getState();
$config = [
   
       'access_type' => 'offline',
       'prompt' => 'consent',
];
header('Location: ' . $oauth2->buildFullAuthorizationUri($config));
exit;
 
} elseif (empty($_GET['state']) || ($_GET['state'] !== 
$_SESSION['oauth2state'])){
  
  unset($_SESSION['oauth2state']);
  exit('Invalid state.');
 
} else {
$oauth2->setCode($_GET['code']);
$authToken = $oauth2->fetchAuthToken();
$refreshToken = $authToken['refresh_token'];
$path = "xxxxxx/google-api/vendor/adsapi_php.ini";
$session = (new AdWordsSessionBuilder())
   ->fromFile($path)
   ->withOAuth2Credential($oauth2)
   ->build();
$adWordsServices = new AdWordsServices();
$campaignService = $adWordsServices->get($session, CampaignService::class);
print_r($campaignService);
}

7 Temmuz 2020 Salı tarihinde saat 21:52:43 UTC+2 itibarıyla 
adsapiforumadvisor şunları yazdı:

> Hello,
>
> Thank you for clarifying! It does not look like this is possible for 
> Google Ads API. I have raised a feature request on your behalf. If the team 
> decides this is a viable request, you can find updates on our blog 
> <https://ads-developers.googleblog.com/> if it is available in future 
> releases.
>
> Let me know if you have any additional questions.
>
>
> Regards,
> Danica, Google Ads API Team
>
> ref:_00D1U1174p._5004Q21j8f3:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/ca7fc2db-bd71-41e3-bf95-65c6f4e7d928n%40googlegroups.com.

Reply via email to