Authen::GoogleAccount - Simple Authentication with Google Account


Authen-GoogleAccount documentation  | view source Contained in the Authen-GoogleAccount distribution.

Index


NAME

Top

Authen::GoogleAccount - Simple Authentication with Google Account

VERSION

Top

Version 0.02

SYNOPSIS

Top

    # step 1
    # redirect to goole to get token
    use CGI;
    use Authen::GoogleAccount;
    my $q = CGI->new;
    my $ga = Authen::GoogleAccount->new;

    # set callback url to verify token
    my $next = "http://www.example.com/googleauth.cgi";
    my $uri_to_login = $ga->uri_to_login($next);

    print $q->redirect($uri_to_login);

    


    


    # step 2
    # user will be redirected to http://www.example.com/googleauth.cgi?token=(token)
    # get token with CGI.pm and give it to verify()
    use CGI;
    use Authen::GoogleAccount;

    my $google_base_data_api_key = "fwioe2fqwoajieqawerq123ae...";

    my $q = CGI->new;
    my $ga = Authen::GoogleAccount->new(
    	key => $google_base_data_api_key,
    );

    my $token = $q->param('token');

    $ga->verify($token) or die $ga->errstr;
    print "login succeeded\n";
    print $ga->name, " ", $ga->email, "\n";
    #"email" may be unique.







FUNCTIONS

Top

new(key => $google_base_data_api_key)

Creates a new object. Requires Google Base data API Key. http://code.google.com/apis/base/signup.html

uri_to_login($next)

Creates a URI to login Google Account.

User will be redirected to $next with token after a successful login.

verify($token)

Verifies given token and returns true when the token is successfully verified.

name

Returns user name.

email

Returns user email("anon-~~~~@base.google.com"). It may be unique.

errstr

Returns error message.

delete_item

get_item

post_item

upgrade_to_session_token

revoke_session_token

init

AUTHOR

Top

Hogeist, <mahito at cpan.org>, http://www.ornithopter.jp/

BUGS

Top

Please report any bugs or feature requests to bug-authen-googleaccount at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Authen-GoogleAccount. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Authen::GoogleAccount

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Authen-GoogleAccount

* CPAN Ratings

http://cpanratings.perl.org/d/Authen-GoogleAccount

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Authen-GoogleAccount

* Search CPAN

http://search.cpan.org/dist/Authen-GoogleAccount

COPYRIGHT & LICENSE

Top


Authen-GoogleAccount documentation  | view source Contained in the Authen-GoogleAccount distribution.