Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Net::Google::AnalyticsUseruContributed Perl DNet::Google::Analytics::OAuth2(3)

NAME
       Net::Google::Analytics::OAuth2 -	OAuth2 for Google Analytics API

VERSION
       version 3.03

SYNOPSIS
	   use Net::Google::Analytics;
	   use Net::Google::Analytics::OAuth2;

	   my $client_id     = "123456789012.apps.googleusercontent.com";
	   my $client_secret = "rAnDoMsEcReTrAnDoMsEcReT";
	   my $refresh_token = "RaNdOmSeCrEtRaNdOmSeCrEt";

	   my $analytics = Net::Google::Analytics->new;

	   # Authenticate
	   my $oauth = Net::Google::Analytics::OAuth2->new(
	       client_id     =>	$client_id,
	       client_secret =>	$client_secret,
	   );
	   my $token = $oauth->refresh_access_token($refresh_token);
	   $analytics->token($token);

DESCRIPTION
       OAuth2 class for	Net::Google::Analytics web service.

CONSTRUCTOR
   new
	   my $oauth = Net::Google::Analytics::OAuth2->new(
	       client_id     =>	$client_id,	 # required
	       client_secret =>	$client_secret,	 # required
	       redirect_uri  =>	$redirect_uri,
	   );

       Create a	new object. Use	the client id and client secret	from the
       Google APIs Console. $redirect_uri is optional and defaults to
       'urn:ietf:wg:oauth:2.0:oob' for installed applications.

METHODS
   authorize_url
	   my $url = $oauth->authorize_url(%extra_params);
	   my $url = $oauth->authorize_url(\%extra_params);

       Returns a Google	URL where the user can authenticate, authorize the
       application and retrieve	an authorization code. %extra_params can be
       used to pass additional authorization parameters. See
       <https://developers.google.com/accounts/docs/OAuth2WebServer#formingtheurl>.

   get_access_token
	   my $token = $oauth->get_access_token($code);

       Retrieves an access token and a refresh token using an authorization
       code.  Returns a	hashref	with the following entries:

       access_token

       refresh_token

       expires_in

       token_type

   refresh_access_token
	   my $token = $oauth->refresh_access_token($refresh_token);

       Retrieves a new access token using a refresh token. Returns a hashref
       with the	following entries:

       access_token

       expires_in

       token_type

   interactive
	   $oauth->interactive;

       Obtain and print	an access and refresh token interactively using	the
       console.	 The user is prompted to visit a Google	URL and	enter a	code
       from that page.

AUTHOR
       Nick Wellnhofer <wellnhofer@aevum.de>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2015 by Nick Wellnhofer.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.24.1			  2015-03-18 Net::Google::Analytics::OAuth2(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | CONSTRUCTOR | METHODS | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Net::Google::Analytics::OAuth2&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help