So I previously was using ClientLogin for authorization in the Google AdWords API but after looking at AuthForInstalledApps it says that this mechanism has been deprecated in favor of OAuth2.0
I have registered my application in the API Consoles. Now I am trying to follow the perl example of how to set this up:
I cannot place the AdWords Client, credentials in ~/adwords.properties since I have multiple accounts that I will be doing Campaign Management operations on, and therefore multiple client ids.
But for now I tried to follow this example by using just one of my client’s info like this:
my $client = Google::Ads::AdWords::Client->new(
{
version => 'v201206',
developer_token => TOKEN,
client_id => $google_account_id
}
);
$client->get_auth_token_handler()->set_email($login);
$client->get_auth_token_handler()->set_password($password);
However when I step through this, when it tries to initialize the Client object it throws this error:
Can't use an undefined value as a HASH reference at (eval 845)[/usr/lib/perl5/vendor_perl/5.8.8/HTTP/Message.pm:371] line 1. at (eval 845)[/usr/lib/perl5/vendor_perl/5.8.8/HTTP/Message.pm:371] line 1
HTTP::Message::__ANON__[(eval 845)[/usr/lib/perl5/vendor_perl/5.8.8/HTTP/Message.pm:371]:1]() called at /home/etienne/backend/libs/Google/Ads/Common/HTTPTransport.pm line 30
Google::Ads::Common::HTTPTransport::client('Google::Ads::Common::HTTPTransport=HASH(0xb59b830)', 'Google::Ads::AdWords::Client=SCALAR(0x9b9bb60)') called at /home/etienne/backend/libs Google/Ads/AdWords/Client.pm line 180
Google::Ads::AdWords::Client::START('Google::Ads::AdWords::Client=SCALAR(0x9b9bb60)', 1, 'HASH(0xb582e70)') called at /usr/lib/perl5/site_perl/5.8.8/Class/Std/Fast.pm line 251
Class::Std::Fast::__ANON__[/usr/lib/perl5/site_perl/5.8.8/Class/Std/Fast.pm:252]() called at /usr/lib/perl5/site_perl/5.8.8/Class/Std/Fast.pm line 287
Class::Std::Fast::new('Google::Ads::AdWords::Client', 'HASH(0xb54c210)') called at /home/etienne/backend/search_marketing/data_exchange/lib/GoogleAPIv2.pm line 3555
GoogleAPIv2::get_adwords_client('GoogleAPIv2=HASH(0xb556d10)', 4202697829) called at /home/etienne/backend/search_marketing/data_exchange/lib/GoogleAPIv2.pm line 230
GoogleAPIv2::add_campaign('GoogleAPIv2=HASH(0xb556d10)', 'name', 'API Upgrade Test Campaign - 1348613850', 'google_account_id', 4202697829, 'account_id', 207, 'country_code', 'US', ...) called at google_add_campaign.t line 110
main::main() called at google_add_campaign.t line 26
scalar context return from CODE(0x9b909c0): *Class::Std::Fast::_cache
1..3
I am using Perl v5.8.8 . I have installed the latest Adwords Perl Client Library v2.7.2 . Is there some kind of dependency issue?
And how can I go about resolving this issue. Any information you can provide would be very helpful. Thanks.
It looks like I just needed to have the latest HTTP/Message.pm
v6.0.3module installed since the version I had installed did not have the methoddecode()which was being passed to theAUTOLOAD()subroutine in theHTTP/Message.pmmodule.