Google::Ads::Common::AuthToken |
Google::Ads::Common::AuthToken
use Google::Ads::Common::AuthToken;
my $token; eval { $token = Google::Ads::Common::AuthToken::get_token({ email => "user@domain.com", password => "password", service => "adwords" }); }; if ($@) { # $@ will contain a string explaining why the token request failed. } else { # Make use of $token. }
Google::Ads::Common::AuthToken exposes one static method, get_token()
.
A static method that attempts to log in to Google's ClientLogin service with the provided credentials. The credentials should correspond to an active Google Account; more info on Google Accounts can be found at https://www.google.com/accounts/ManageAccount.
A hash reference with two keys: { # The service name to access. service => "adwords", # The email address of a Google Account. email => "user@domain.com", # The password for the Google Account. password => "password", }
A string containing the auth token suitable for use with the API.
If the attempt to log in fails, either due to bad or missing credentials or an
HTTP error contacting the service, get_token()
will die()
with a descriptive
error message.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Jeffrey Posnick <api.jeffy at gmail.com>
David Torres <api.davidtorres at gmail.com>
$Rev: $ $LastChangedBy: $ $Id: $
Google::Ads::Common::AuthToken |