|
NAMENet::Google::DataAPI::Auth::OAuth2 - OAuth2 support for Google Data APIs SYNOPSIS use Net::Google::DataAPI::Auth::OAuth2;
my $oauth2 = Net::Google::DataAPI::Auth::OAuth2->new(
client_id => 'xxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
client_secret => 'mys3cr33333333333333t',
scope => ['http://spreadsheets.google.com/feeds/'],
# with web apps, redirect_uri is needed:
#
# redirect_uri => 'http://your_app.sample.com/callback',
);
my $url = $oauth2->authorize_url();
# show the user $url and get $code
# if you're making web app, you will do:
#
# return $c->redirect($auth->authorize_url());
#
# getting $code from the request to the 'redirect_uri' in web apps:
#
# my $code = $c->req->param('code');
#
# in installed apps:
#
# use Term::Prompt;
# my $code = prompt('x', 'paste the code: ', '', '');
my $token = $oauth2->get_access_token($code) or die;
# after retrieving $token, you can use $oauth2 with Net::Google::DataAPI items:
my $client = Net::Google::Spreadsheets->new(auth => $oauth2);
DESCRIPTIONNet::Google::DataAPI::Auth::OAuth2 interacts with google OAuth 2.0 service and adds Authorization header to given request. ATTRIBUTESYou can make Net::Google::DataAPI::Auth::OAuth2 instance with those arguments below:
See <https://developers.google.com/accounts/docs/OAuth2> for details. AUTHORNobuo Danjou <danjou@soffritto.org> SEE ALSONet::OAuth2 <https://developers.google.com/accounts/docs/OAuth2> you can see sample implementations for oauth2 client both as installed and web app in the eg directory of this distribution. LICENSEThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|