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

Problem with Oauth2 in v5.5.1. #62

Closed
DenisOgr opened this issue Aug 26, 2014 · 1 comment
Closed

Problem with Oauth2 in v5.5.1. #62

DenisOgr opened this issue Aug 26, 2014 · 1 comment
Assignees
Labels

Comments

@DenisOgr
Copy link

After update to v5.5.1. my old script throws exceptions. It in two places different exceptions:
First:

$user =  new \AdWordsUser(\Yii::$app->params['google.services.settings']['authenticationIniPath'],     $email = NULL, $password = NULL, $developerToken = NULL, $applicationToken = NULL,            $userAgent = NULL, 'XXXX-XXXXX-XXXX-XXXX', $settingsIniPath = NULL,  $authToken = NULL, $oauthInfo = NULL);
$adGroupService = $user->GetService('AdGroupService', 'v201402');

Exception:

Validation failed for [client_id] with value []: client_id is required.
 /home/www-data/www/adwyii/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/Common/Lib/AdsUser.php at line 522
2. in /home/www-data/www/adwyii/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php – AdsUser::ValidateOAuth2Info() at line 355
3. in /home/www-data/www/adwyii/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php – AdWordsUser::ValidateUser() at line 222
4. in /home/www-data/www/adwyii/frontend/modules/keywordsgeneration/controllers/DefaultController.php – AdWordsUser::GetService('AdGroupService', 'v201402') at line 45
5. frontend\modules\keywordsgeneration\controllers\DefaultController::actionCreate()
6. in /home/www-data/www/adwyii/vendor/yiisoft/yii2/base/InlineAction.php – call_user_func_array([frontend\modules\keywordsgeneration\controllers\DefaultController, 'actionCreate'], []) at line 55
7. in /home/www-data/www/adwyii/vendor/yiisoft/yii2/base/Controller.php – yii\base\InlineAction::runWithParams(['r' => 'keywordsgeneration/default/creat...']) at line 150
8. in /home/www-data/www/adwyii/vendor/yiisoft/yii2/base/Module.php – yii\base\Controller::runAction('create', ['r' => 'keywordsgeneration/default/creat...']) at line 462
9. in /home/www-data/www/adwyii/vendor/yiisoft/yii2/web/Application.php – yii\base\Module::runAction('keywordsgeneration/default/creat...', ['r' => 'keywordsgeneration/default/creat...']) at line 83
10. in /home/www-data/www/adwyii/vendor/yiisoft/yii2/base/Application.php – yii\web\Application::handleRequest(yii\web\Request) at line 371
11. in /home/www-data/www/adwyii/frontend/web/index.php – yii\base\Application::run()

Second:

 $user =  new \AdWordsUser(\Yii::$app->params['google.services.settings']['authenticationIniPath'], $email = NULL,
                $password = NULL, $developerToken = NULL, $applicationToken = NULL,
                $userAgent = NULL, $clientId = 'XXX-XXX-XXX', $settingsIniPath = NULL,
                $authToken = NULL, $oauthInfo = NULL);

$reportQuery = 'SELECT Ctr,AdGroupId, AverageCpc, CostPerConversion, ConversionRate,Cost,Impressions, CampaignName, AdGroupName, AccountDescriptiveName '
                . 'FROM ADGROUP_PERFORMANCE_REPORT '
                . 'WHERE Status= "ENABLED" AND AdNetworkType1=SEARCH AND CampaignId=1  DURING 20050101,' . date('Ymd');
 \ReportUtils::DownloadReportWithAwql($reportQuery, $csvFileForGroup, $user, 'CSV', $options);

Exception:

PHP Recoverable Error 'yii\base\ErrorException' with message 'Argument 1 passed to OAuth2Handler::GetOrRefreshAccessToken() must be of the type array, string given, called in /home/www-data/www/adwyii/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/ReportUtils.php on line 313 and defined'

When I use revision with commit hash: 52123a0 it works fine

@vtsao
Copy link
Contributor

vtsao commented Aug 26, 2014

The constructor signature of AdWordsUser was changed with the removal of ClientLogin support in 5.5.1. So you'll need to update your constructor params.

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

No branches or pull requests

3 participants