Hi,

It seems you have problems with SOAP authentication.
I highly recommend you to use our client library 
<https://developers.google.com/adwords/api/docs/clientlibraries>, which is 
also available in PHP as well.

Could you please try that first and see if you can get through it? 
You can easily fill in your credential information in auth.ini 
<https://github.com/googleads/googleads-php-lib/blob/master/src/Google/Api/Ads/AdWords/auth.ini>
 
(in case of PHP), hence there is no need to tweak your $user variable.

By the way, you need not to fill in an access token, as a refresh token 
required in auth.ini 
<https://github.com/googleads/googleads-php-lib/blob/master/src/Google/Api/Ads/AdWords/auth.ini>
 will 
be used to generate new access tokens when needed.
Using our client libraries should help you bypass these overheads of SOAP 
authentication.

You can find more information about how to setup the PHP client library here 
<https://github.com/googleads/googleads-php-lib#user-content-getting-started>
.

Best Regards,
Thanet, AdWrods API Team

On Monday, June 1, 2015 at 9:44:02 PM UTC+9, Abhishek Dutt wrote:
>
> Hi,
>
> I have been  working on Google Adword API and am using PHP client sdk to 
> request the SOAP call.
> I have gone through the basic setup process.
> I have created a Production MCC account and got a developer  Token from 
> there which is pending from an email address.
> So to test i created another Test MCC account using another email account.
> From this test MCC account , i created a test adword account which itself 
> by default got linked, this got me my clientCustomerId
> Now to get client id and client secret , I used the google console to 
> create a project and create the client id. I used  Web Application Type to 
> create the client id and put the redirection url to 
> https://developers.google.com/oauthplayground
> In the playground , i specified  client id , secret key in the setting and 
> then the scope https://www.googleapis.com/auth/adwords to authorize, 
> which got me the authorization code which then i exchanged to get referesh 
> token  and access token.
> Now when i use them in my file , till the time i access the user object , 
> i get everything , but lets suppose i want to get a list of campaign then 
> it shows the following error :
>
> Fatal error: Uncaught SoapFault exception: [soap:Server] 
> [AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>'] in 
> C:\wamp\www\googleAdwords\lib\Google\Api\Ads\Common\Lib\AdsSoapClient.php:231 
> Stack trace: #0 
> C:\wamp\www\googleAdwords\lib\Google\Api\Ads\Common\Lib\AdsSoapClient.php(231):
>  
> SoapClient->__soapCall('get', Array, NULL, Array, Array) #1 
> C:\wamp\www\googleAdwords\lib\Google\Api\Ads\AdWords\v201409\CampaignService.php(7777):
>  
> AdsSoapClient->__soapCall('get', Array) #2 
> C:\wamp\www\googleAdwords\campaign.php(60): 
> CampaignService->get(Object(Selector)) #3 {main} thrown in 
> C:\wamp\www\googleAdwords\lib\Google\Api\Ads\Common\Lib\AdsSoapClient.php 
> on line 231
>
> Meanwhile , here is the code , with keys removed
>
> <?php
>
> $path = dirname(__FILE__) . '/lib'; 
> set_include_path(get_include_path() . PATH_SEPARATOR . $path);
> require_once dirname(__FILE__) . 
> '/lib/Google/Api/Ads/AdWords/Lib/AdWordsUser.php'; 
> require_once dirname(__FILE__) . 
> '/lib/Google/Api/Ads/AdWords/Util/ReportUtils.php';
>
>
> define("OAUTH_CLIENT_ID", "[****]");
> define("OAUTH_CLIENT_SECRET", "[****]");
> define("OAUTH_ACCESS_TOKEN", "[****]");
> define("OAUTH_REFRESH_TOKEN", "[*****]");
> define("CUSTOMER_ACCOUNT_ID", "[*****]");
> define("DEVELOPER_TOKEN", "[****]");
> define("API_VERSION", "v201409");
>  
> $user = new AdWordsUser();
> $user->SetDeveloperToken(DEVELOPER_TOKEN);
> $user->SetClientCustomerId(CUSTOMER_ACCOUNT_ID);
>
> print_r($user); 
>
> $user->SetOAuth2Info(array(
>     "client_id" => OAUTH_CLIENT_ID,
>     "client_secret" => OAUTH_CLIENT_SECRET,
>     "access_token" => OAUTH_ACCESS_TOKEN,
>     "refresh_token" => OAUTH_REFRESH_TOKEN
> ));
>  
> $user->LoadService('ReportDefinitionService', API_VERSION);
>  
> print_r($user);
>
>
>
> // Get a list of campaigns
> $campaignService = $user->GetService('CampaignService', API_VERSION);
> $selector = new Selector();
> $selector->fields = array('Id', 'Name');
> $campaigns = $campaignService->get($selector);
>  
> print_r($campaigns);
>
>
> ?>
>
>
> Please help me out !
> I am not able to find a way out
>
> Thanks
> Abhishek Dutt
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscr...@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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/57a24829-0bab-4d0a-8a19-cc19d1bb2b36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to