NAME
Yahoo::BBAuth - Perl interface to the Yahoo! Browser-Based
Authentication.
SYNOPSIS
my $bbauth = Yahoo::BBAuth->new(
appid => $appid,
secret => $secret,
);
# Create an authentication link
printf 'Click here to authorize', $bbauth->auth_url;
# After the user authenticates successfully, Yahoo returns the user to the page you
# dictated when you signed up. To verify whether authentication succeeded, you need to
# validate the signature:
if ($bbauth->validate_sig()) {
print 'Authentication Successful';
} else {
print 'Authentication Failed. Error is: '.$bbauth->sig_validation_error;
}
my $url = 'http://photos.yahooapis.com/V1.0/listAlbums';
my $xml = $bbauth->auth_ws_get_call($url);
unless ($xml) {
print 'WS call setup Failed. Error is: '. $bbauth->access_credentials_error;
} else {
print 'Look at response for other errors or success: '.$xml;
}
DESCRIPTION
This module priovides you an Object Oriented interface for Yahoo!
Browser-Based Authentication.
This module is ported from official PHP class
library(http://developer.yahoo.com/auth/quickstart/bbauth_quickstart.zip
).
METHODS
new(appid => $appid, secret => $secret)
Returns an instance of this module. You must set the your application id
and shared secret.
auth_url(%param)
Create the Login URL used to fetch authentication credentials. This is
the first step in the browser authentication process.
You can set the %param to send_userhash and appdata if you
need(optinal).
The appdata typically a session id that Yahoo will transfer to the
target application upon successful authentication.
If send_userhash set, the send_userhash=1 request will be appended to
the request URL so that the userhash will be returned by Yahoo! after
successful authentication.
validate_sig
Validates the signature returned by Yahoo's browser authentication
services.
Returns true if the sig is validated. Returns undef if any error occurs.
If undef is returned, $self->sig_validation_error should contain a
string describing the error.
auth_ws_get_call($url)
Make an authenticated web services call using HTTP GET. Returns responce
if successful, a string is returned containing the web service response
which might be XML, JSON, or some other type of text. If an error
occurs, the error is stored in $self->access_credentials_error.
auth_ws_post_call($url)
Make an authenticated web services call using HTTP POST.
sig_validation_error
Returns error message when validate_sig failed.
access_credentials_error
Returns error message when auth_ws_get_call or auth_ws_post_call failed.
ACCESSORS
appid
secret
userhash
appdata
timeout
token
WSSID
cookie
AUTHOR
Jiro Nishiguchi
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
* http://developer.yahoo.com/auth/