NAME
Hatena::API::Auth - Perl intaface to the Hatena Authentication API
VERSION
Version 0.04
SYNOPSIS
use Hatena::API::Auth;
my $api = Hatena::API::Auth->new({
api_key => '...',
secret => '...',
});
my $uri = $api->uri_to_login;
print $uri->as_string;
my $cert = $q->param('cert');
my $user = $api->login($cert) or die "Couldn't login: " . $api->errstr;
$user->name;
$user->image_url;
$user->thumbnail_url;
DESCRIPTION
A simple interface for using the Hatena Authentication API http://auth.hatena.ne.jp/.
METHODS
- new({ api_key => '...', secret => '...' })
-
Returns an instance of Hatena::API::Auth. It requires two parameters, "api_key" and "secret" which can be retrieved from the Web site of Hatena Authentication API (http://auth.hatena.ne.jp/).
- uri_to_login(%extra)
-
Returns a URI object which is associated with the login url and required parameters. You can also use this method in your templates of Template like this:
<a href="[% api.uri_to_login %]">login</a>
uri_to_login
takes extra URI parameters as arguments like this:<a href="[% api.uri_to_login(foo => 'bar', bar => 'baz') %]">login</a>
Then extracted URI will have extra URI parameters such as
foo=bar&bar=baz
. Those parameters will be passed to the Authentication API. They will be returned to your application as query parameters of the callback URL. - login($cert)
-
Logs into Hatena with a Web API and returns a Hatena::API::Auth::User object which knows some information of the logged user. It requires "cert", which can be retrieved from the web site, as an argument.
The user object has some accessor for user's information.
- api_sig($request)
-
An internal method for generating signatures.
- ua
-
Set/Get HTTP a user-agent for custormizing its behaviour.
AUTHOR
Naoya Ito, <naoya at bloghackers.net>
BUGS
Please report any bugs or feature requests to bug-hatena-api at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hatena-API-Auth. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Hatena::API::Auth
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
SEE ALSO
Hatena Authentication API http://auth.hatena.ne.jp/ Hatena http://www.hatena.ne.jp/
COPYRIGHT & LICENSE
Copyright 2006 Naoya Ito, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.