GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::Google::DataAPI::Auth::OAuth2(3) User Contributed Perl Documentation Net::Google::DataAPI::Auth::OAuth2(3)

Net::Google::DataAPI::Auth::OAuth2 - OAuth2 support for Google Data APIs

  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);

Net::Google::DataAPI::Auth::OAuth2 interacts with google OAuth 2.0 service and adds Authorization header to given request.

You can make Net::Google::DataAPI::Auth::OAuth2 instance with those arguments below:
  • 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.

Nobuo Danjou <danjou@soffritto.org>

Net::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.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2012-04-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.