The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Google::Ads::Common::OAuth2ApplicationsHandler

DESCRIPTION

A generic abstract implementation of Google::Ads::Common::OAuth2BaseHandler that supports OAuth2 for Web/Install Applications semantics.

It is meant to be specialized and its _scope and _formatted_scopes methods be properly implemented.

ATTRIBUTES

Each of these attributes can be set via Google::Ads::Common::OAuth2ApplicationsHandler->new().

Alternatively, there is a get_ and set_ method associated with each attribute for retrieving or setting them dynamically.

api_client

A reference to the API client used to send requests.

client_id

OAuth2 client id obtained from the Google APIs Console.

client_secret

OAuth2 client secret obtained from the Google APIs Console.

access_type

OAuth2 access type to be requested when following the authorization flow. It defaults to offline but it can be set to online.

prompt

OAuth2 prompt to be used when following the authorization flow. It defaults to consent.

redirect_uri

Redirect URI as set for you in the Google APIs console, to which the authorization flow will callback with the verification code. Defaults to urn:ietf:wg:oauth:2.0:oob for the installed applications flow.

access_token

Stores an OAuth2 access token after the authorization flow is followed or for you to manually set it in case you had it previously stored. If this is manually set this handler will verify its validity before preparing a request.

refresh_token

Stores an OAuth2 refresh token in case of an offline access_type is requested. It is automatically used by the handler to request new access tokens i.e. when they expire or found invalid.

additional_scopes

Stores additional OAuth2 scopes as a comma-separated string. The scope defines which services the tokens are allowed to access e.g. https://www.googleapis.com/auth/analytics

METHODS

initialize

Initializes the handler with properties such as the client_id and client_secret to use for generating authorization requests.

Parameters

  • A required api_client with a reference to the API client object handling the requests against the API.

  • A hash reference with the following keys: { # Refer to the documentation of the client_secret property. oAuth2ClientId => "client-id", # Refer to the documentation of the client_secret property. oAuth2ClientSecret => "client-secret", # Refer to the documentation of the access_type property. oAuth2AccessType => "access-type", # Refer to the documentation of the prompt property. oAuth2ApprovalPrompt => "approval-prompt", # Refer to the documentation of the refresh_token property. oAuth2AccessToken => "access-token", # Refer to the documentation of the refresh_token property. oAuth2RefreshToken => "refresh-token", # Refer to the documentation of the redirect_uri property. oAuth2RedirectUri => "secret", }

is_auth_enabled

Refer to Google::Ads::Common::AuthHandlerInterface documentation of this method.

prepare_request

Refer to Google::Ads::Common::AuthHandlerInterface documentation of this method.

get_authorization_url

Refer to Google::Ads::Common::OAuthApplicationsHandlerInterface documentation of this method.

issue_access_token

Refer to Google::Ads::Common::OAuthApplicationsHandlerInterface documentation of this method.

LICENSE AND COPYRIGHT

Copyright 2013 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.

REPOSITORY INFORMATION

 $Rev: $
 $LastChangedBy: $
 $Id: $