Google::Ads::GoogleAds::OAuth2ApplicationsHandler
A concrete implementation of Google::Ads::GoogleAds::Common::OAuth2BaseHandler and Google::Ads::GoogleAds::Common::OAuthApplicationsHandlerInterface that supports OAuth2 for Web/Desktop applications and defines the scope required to access the Google Ads API server.
See https://developers.google.com/identity/protocols/oauth2 for details of the protocol.
Each of these attributes can be set via Google::Ads::GoogleAds::OAuth2ApplicationsHandler->new().
Alternatively, there is a get_ and set_ method associated with each attribute for retrieving or setting them dynamically.
A reference to the API client used to handle the API requests.
OAuth2 client id obtained from the Google APIs console.
OAuth2 client secret obtained from the Google APIs console.
OAuth2 access type to be requested when following the authorization flow. It defaults to offline but it can be set to online.
OAuth2 prompt to be used when following the authorization flow. It defaults to consent.
Redirect URI to which the authorization flow will callback with the authorization code. If using Web flow, the redirect URI must match exactly what’s configured in GCP for the OAuth client. If using Desktop flow, the redirect must be a localhost URL and is not explicitly set in GCP. The default is http://127.0.0.1.
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.
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 are expired or found invalid.
Stores additional OAuth2 scopes as a comma-separated string. These scopes define which services the tokens are allowed to access, e.g. https://www.googleapis.com/auth/analytics.
Initializes the handler with the API client object and the properties such as client_id and client_secret, used for generating authorization requests.
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:
{ clientId => "client-id", clientSecret => "client-secret", accessType => "access-type", approvalPrompt => "approval-prompt", redirectUri => "redirect-uri", accessToken => "access-token", refreshToken => "refresh-token", additionalScopes => "additional-scopes", }
Refer to the documentation of the properties as "client_id", "client_secret", "access_type", "prompt", "redirect_uri", "access_token", "refresh_token" and "additional_scopes".
Refer to Google::Ads::GoogleAds::Common::AuthHandlerInterface documentation of this method.
Refer to Google::Ads::GoogleAds::Common::OAuthApplicationsHandlerInterface documentation of this method.
Method defined by Google::Ads::GoogleAds::Common::OAuth2BaseHandler and implemented in this class to return the required OAuth2 scopes as an array.
Method defined by Google::Ads::GoogleAds::Common::OAuth2BaseHandler and implemented in this class to refresh the stored OAuth2 access token.
Private method to return the OAuth2 scopes as a list of encoded URLs separated by pluses. This is the format expected when sending the OAuth2 request in a URL.
The encoded URL string of OAuth2 scopes separated by pluses.
Copyright 2022 Google LLC
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.
$Rev: $ $LastChangedBy: $ $Id: $
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'what’s'. Assuming UTF-8
To install Google::Ads::GoogleAds::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Google::Ads::GoogleAds::Client
CPAN shell
perl -MCPAN -e shell install Google::Ads::GoogleAds::Client
For more information on module installation, please visit the detailed CPAN module installation guide.