Google::RestApi::OAuth2 - OAuth2 support for Google Rest APIs
use Google::RestApi::OAuth2; my $oauth2 = Google::RestApi::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(); # you can add optional parameters: my $url = $oauth2->authorize_url( access_type => 'offline', approval_prompt => 'force', ); # generate an access token from the code returned from Google: my $token = $oauth2->access_token($code);
Google::RestAPI::OAuth2 interacts with google OAuth 2.0 service and adds the 'Authorization' header to subsequent requests.
This was copied from Google::DataAPI::Auth::OAuth2 and modified to fit this framework. The other framework was dated and produced constant warnings to upgrade to Moo. I removed Moose since I didn't use Moose anywhere else in this framework.
client_id
client id. You can get it at https://code.google.com/apis/console#access.
client_secret
The client secret paired with the client id.
scope
URL identifying the service(s) to be accessed. You can see the list of the urls to use at: http://code.google.com/intl/en-US/apis/gdata/faq.html#AuthScopes
redirect_url
OAuth2 redirect url. 'urn:ietf:wg:oauth:2.0:oob' will be used if you don't specify it.
See https://developers.google.com/accounts/docs/OAuth2 for details.
Robin Murray <mvsjes@cpan.ork<gt>, copied and modifed from Google::DataAPI::Auth::OAuth2.
OAuth2
Google::DataAPI::Auth::OAuth2
https://developers.google.com/accounts/docs/OAuth2
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Google::RestApi, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Google::RestApi
CPAN shell
perl -MCPAN -e shell install Google::RestApi
For more information on module installation, please visit the detailed CPAN module installation guide.