NAME

Net::Google::AuthSub::Once - Make one secure authenticated request to a Google service

SYNOPSYS

my $auth = Net::Google::AuthSub::Once->new();
redirect_to($auth->get_authorization_url('http://example.com/your-next-url'));

# Then after the response comes back

# Make a request to the Google service
my $auth = Net::Google::AuthSub::Once->new({ private_key_filename => 'filename' });
my $request = HTTP::Request->new(GET => 'http://www.google.com/...');
$auth->sign_request($request);
my $resp = $ua->request($request);

DESCRIPTION

The nice thing about this module is that you don't need to know the Google login details of the user of your applications. You can make a secure request to a Google service in their place.

You must add your domain on Google for using secure requests. This module only supports secure requests. https://www.google.com/accounts/ManageDomains

Google has some information about create the private key file you need.

http://code.google.com/apis/gdata/docs/auth/authsub.html#Registered

METHODS

CLASS->new($options)

  • private_key_filename

    The filename of a private key file.

$self->get_authorization_url($next_url)

Returns the authorization url that you need to redirect to. Next_url is the url that google will redirect you to after the request was authorized.

$self->sign_request($request, $url, $token)

Signs the HTTP::Request.

AUTHOR

Peter Stuifzand <peter@stuifzand.eu>

COPYRIGHT

Copyright, 2010 - Peter Stuifzand

Released under the same terms as Perl itself