See other
post; https://groups.google.com/forum/#!topic/adwords-api/UKOzC8rfZo4
On Friday, February 24, 2017 at 9:22:17 PM UTC+13, Autoeurope Developer
wrote:
>
>
> Hi All,
>
> I have several scripts that run in cron jobs every day, (to update labels,
> download reports, set bidding options etc...). These have all been working
> fine for over a month, and today I started getting this message:
>
> { "error": "invalid_grant", "error_description": "Bad Request" }
>
> when trying to connect (with both my Test Account Token and my Main MCM
> Account token). I have Standard Access privileges, not sure if it's
> relevant.
>
> Below is a simple script I use just to test the connection (which has also
> been working for over a month, until today). Nothing (really, not a single
> thing) has been changed on my side that could cause this error.
>
>
> Any help is appreciated.
>
> Thank you.
>
>
> <?php
> @session_start();
> if(!isset($_SESSION['ae']['userId'])){
> echo 'Session has expired. please refresh your page and login again.';
> exit();
> }
> $t = microtime();
> require_once '../_adwordsAPI/init.php';
> if(isset($_POST['customerID'])){
> $cID = trim($_POST['customerID']);
> }
> try{
> $user = new AdWordsUser('../_adwordsAPI/auth.ini');
> $user->SetClientCustomerId($cID);
> GetAccountHierarchyExample($user);
> $ms = microtime() - $t;
> echo 'Connection Successful. Ping time = '.round(($ms*1000),3).'ms';
> }catch(Exception $e){
> echo "An error has occurred: " . $e->getMessage();
> }
>
>
> function GetAccountHierarchyExample(AdWordsUser $user){
> $managedCustomerService = $user->GetService('ManagedCustomerService');
> $selector = new Selector();
> $selector->fields = array('CustomerId', 'Name');
> $graph = $managedCustomerService->get($selector);
> if(isset($graph->entries)){
> $cnt = 0;
> foreach ($graph->entries as $account) {
> $cnt ++;
> }
> echo 'This Account has <b>'. ($cnt -1) . '</b> Clients<br><br>';
> }else{
> echo "No accounts were found.<br>";
> }
> }
>
>
> exit();
> ?>
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
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/735d2227-819b-4ed9-b2ee-573ca538b71a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.