Hi,
It look like you use access_token as your refresh_token..
On Wednesday, September 7, 2016 at 2:30:56 AM UTC+8, simon...@outlook.com wrote:
-- It look like you use access_token as your refresh_token..
refresh_token' => $access_token, Thanks
On Wednesday, September 7, 2016 at 2:30:56 AM UTC+8, simon...@outlook.com wrote:
I have an error when I use $campaignService->get($selector );$client = new \Google_Client();
/*
$client->setAuthConfigFile(base_path('google.json')); */
$client->setClientId(getenv('GOOGLE_ID' ));
$client->setClientSecret(getenv ('GOOGLE_SECRET'));
$client->addScope("https://www.googleapis.com/auth/ ");adwords
$client->setRedirectUri('http://localhost/lidogen/public/ ' /*request()->url()*/ );service/google/oauth
$client->setIncludeGrantedScopes( true);
$client->setApprovalPrompt("force" );
$client->setAccessType("offline" );
if (!isset($_GET['code'])) {
$auth_url = $client->createAuthUrl();
header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
exit;
}
if(isset($_GET['code'])) {
$client->authenticate($_GET['code' ]);
$access_token = $client->getAccessToken();
$oauth2Info = [
'client_id' => getenv('GOOGLE_ID'),
'client_secret' => getenv('GOOGLE_SECRET'),
'refresh_token' => $access_token,
];
$user = new \AdWordsUser();
$user->SetOAuth2Info($oauth2Info );
$campaignService = $user->GetService('CampaignService' , 'v201603');
$selector = new \Selector();
$selector->fields = array('Id', 'Name');
$selector->ordering[] = new \OrderBy('Name', 'ASCENDING');
$selector->paging = new \Paging(0, \AdWordsConstants::RECOMMENDED_PAGE_SIZE );
$page = $campaignService->get($selector );
dd($page);
}ErrorException in C:\xampp\
htdocs\lidogen\vendor\ :Array to string conversiongoogleads\googleads-php-lib\ src\Google\Api\Ads\Common\ Util\CurlUtils.php line 116
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscribe@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+unsubscribe@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/2d6a53ed-52c5-410e-a40f-4b848abf0e09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment