Greetings,

I'm having some difficulties switching from the default configuration file 
to using my own variables for auth info.
My issue is pretty straightforward:


 // Generate a refreshable OAuth2 credential for authentication.
 $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile(__DIR__ . 
"/../config/adsapi_php.ini")->build();
 $sessionBuilder = (new AdWordsSessionBuilder())->fromFile(__DIR__ . 
"/../config/adsapi_php.ini")->withOAuth2Credential($oAuth2Credential); 

 var_dump($sessionBuilder);die();

$*sessionBuilder* is 

object(Google\AdsApi\AdWords\AdWordsSessionBuilder)


And everything works flawlessly.
But running this code: 


 // Generate a refreshable OAuth2 credential for authentication.
 $oAuth2Credential = (new OAuth2TokenBuilder())
 ->withClientId($config['adwords_api']["clientId"])
 ->withClientSecret($config['adwords_api']["clientSecret"])
 ->withRefreshToken($config['adwords_api']["refreshToken"])
 ->build();


 // Construct an API session configured from the OAuth2 credentials above.
 $sessionBuilder = (new AdWordsSessionBuilder())
 ->withDeveloperToken($config['adwords_api']["developerToken"])
 ->withOAuth2Credential($oAuth2Credential)
 ->withClientCustomerId($config['adwords_api']["clientCustomerId"])
 ->build();

 var_dump($sessionBuilder);die();


$*sessionBuilder* here is now 

object(Google\AdsApi\AdWords\AdWordsSession)


Obviously throwing errors when calling my next part of the code.


PHP ERROR: Uncaught exception: Argument 2 passed to 
Services\GoogleService::getReport() must be an instance of 
Google\AdsApi\AdWords\AdWordsSessionBuilder, instance of 
Google\AdsApi\AdWords\AdWordsSession given

I do not understand how this can happen, the code is pretty clear on witch 
class it will be instanced, the variables in the $config array are the same 
with the values in the file, also they populate alright in the objects. Both 
project use the same version of the library (38.0.0).
I just hope someone else ran in to this problem and can give me an insight on 
how to solve it.


Thank you,

Good day.


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/affb01d4-0462-46fc-96d9-feed0f1ee23e%40googlegroups.com.

Reply via email to