Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthenticationError.OAUTH_TOKEN_INVALID #46

Open
dee2499 opened this issue Sep 12, 2019 · 1 comment
Open

AuthenticationError.OAUTH_TOKEN_INVALID #46

dee2499 opened this issue Sep 12, 2019 · 1 comment

Comments

@dee2499
Copy link

dee2499 commented Sep 12, 2019

Gettting this error, this is the google-ads.php.

It says OAUTH_TOKEN_INVALID.

<?php
return [
    //Environment=> test/production
    'env' => 'test',
    //Google Ads
    'production' => [
        'developerToken' => "0HZ-----------R7g",
        'clientCustomerId' => "10--------8",
        'userAgent' => "Name",
        'clientId' => "92----------.apps.googleusercontent.com",
        'clientSecret' => "9II---------Kr",
        'refreshToken' => "1/-----------------M"
    ],
    'test' => [
        'developerToken' => "0HZ-----------R7g",
        'clientCustomerId' => "10--------8",
        'userAgent' => "Name",
        'clientId' => "92----------.apps.googleusercontent.com",
        'clientSecret' => "9II---------Kr",
        'refreshToken' => "1/-----------------M"
    ],
    'oAuth2' => [
        'authorizationUri' => 'https://accounts.google.com/o/oauth2/v2/auth',
        'redirectUri' => 'urn:ietf:wg:oauth:2.0:oob',
        'tokenCredentialUri' => 'https://www.googleapis.com/oauth2/v4/token',
        'scope' => 'https://www.googleapis.com/auth/adwords'
    ]
];

And this is my code to fetch the reports

$ads = new GoogleAds();
        $ads->env('test');
        $report = $ads->report();
        $obj = $ads->report()
            ->from('CRITERIA_PERFORMANCE_REPORT')
            ->where('Clicks > 10')
            ->where('Cost > 10')
            ->where('Impressions > 1')
            ->select('CampaignId','AdGroupId','AdGroupName','Id', 'Criteria', 'CriteriaType','Impressions', 'Clicks', 'Cost', 'UrlCustomParameters')
            ->getAsObj();
        print_r($ads);die;

I have got refresh token from oauth playground
running this command php artisan googleads:token:generate gives error
Please provide a valid configuration for Laravel Google Ads

@Edujugon
Copy link
Owner

Hi @dee2499 ,

What package version do you have installed?

I'm trying to reproduce the error, but everything works as expected. I can run php artisan googleads:token:generate without any issue.

Please make sure then 'env' value in your google-ads.php config file is set correctly since those are the values that will be taken when creating the refresh token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants