NAME

WWW::Google::Cloud::Auth::ServiceAccount - Service account based OAuth authentication for Google Cloud APIs

SYNOPSIS

    my $auth = WWW::Google::Cloud::Auth::ServiceAccount>new(
        credentials_path => '/home/myapp/priv/google_some_service.json',
    );

    my $response = $ua->post(
		 $some_google_cloud_api_endpoint,
		'Content-Type' => 'application/json; charset=utf-8',
		'Authorization' => 'Bearer ' . $auth->get_token,
		 Content => $arguments,
	);

DESCRIPTION

This is a library for service account based OAuth authentication with Google Cloud API endpoints for server to server applications. See: https://developers.google.com/identity/protocols/OAuth2ServiceAccount

FUNCTIONS

WWW::Google::Cloud::Auth::ServiceAccount->new(credentials_path => $credentials_path);

Instantiate a new WWW::Google::Cloud::Auth::ServiceAccount object.

Arguments:

  • credentials path [required]

    The path to the JSON-encoded credentials file provided by Google.

  • auth_url [optional]

    The URL to get the OAuth token from. Defaults to https://www.googleapis.com/oauth2/v4/token. You probably don't need to change this.

Returns:

    A new WWW::Google::Cloud::Auth::ServiceAccount instance.

$auth->get_token()

Get a valid token to use for authorization. If there is a valid cached token return that.

Arguments:

    None

Returns:

    The OAuth token

AUTHOR

This module is written by Larion Garaczi <larion@cpan.org> (2019)

SOURCE CODE

The source code for this module is hosted on GitHub https://github.com/larion/www-google-cloud-auth-serviceaccount.

Feel free to contribute :)

LICENSE AND COPYRIGHT

This module is free software and is published under the same terms as Perl itself.