WWW::Facebook::API::Auth(3) Facebook Authentication

SYNOPSIS


use WWW::Facebook::API;

DESCRIPTION

Methods for accessing auth with WWW::Facebook::API

SUBROUTINES/METHODS

base
Returns the WWW::Facebook::API base object.
new
Constructor.
create_token()
auth.createToken of the Facebook API. Will always return the token string, regardles of the "parse" setting in WWW::Facebook::API:

    $token = $client->auth->create_token;
get_session( $token )
auth.getSession of the Facebook API. If you have the desktop attribute set to true and $token isn't passed in, the return value from "$client->auth->create_token" will be used. If the desktop attribute is set to false the $token must be the auth_token returned from Facebook to your web app for that user:

    if ( $q->param('auth_token')  ) {
        $client->auth->get_session( $q->param('auth_token') );
    }

"get_session" automatically sets "session_uid", "session_key", and "session_expires" for $client. It returns nothing.

login( sleep => $sleep , browser => $browser_cmd )
Only for desktop apps. It first calls "create_token" to get a valid token. It then opens the user's default browser and have them sign in to the Facebook application. If "browser" is passed in, the module will use that string as the command to execute, e.g.:

    system qq($browser_cmd "$login_url");

After the browser is called, it will pause for $sleep seconds (or 15 seconds if $sleep is not defined), to give the user time to log in. The method returns the session token created by "create_token".

expire_session( %params)
Implementation of the auth.expireSession function.

    $result = $client->auth->expire_session();
promote_session( %params)
Implementation of the auth.promoteSession function.

    $result = $client->auth->promote_session();
revoke_authorization( %params)
Implementation of the auth.revokeAuthorization function.

    $result = $client->auth->revoke_authorization();
revoke_extended_permission( %params)
Implementation of the auth.revokeExtendedPermission function.

    $result = $client->auth->revoke_extended_permission(
                    perm => 'email',
                    uid  => $uid
    );
logout()
Sends a POST to http://www.facebook.com/logout.php, with the parameter ``confirm'' set to 1 (Cf. http://developers.facebook.com/documentation.php?v=1.0&doc=auth )

PRIVATE METHODS

_use_http_uri()
Makes the WFA object's server URI scheme http. Uses "_flip_scheme".
_use_https_uri()
Makes the WFA object's server URI scheme https. Uses "_flip_scheme".
_flip_scheme( $make_https )
If $make_https is true, the scheme becomes https. If false, the scheme becomes http. The WFA object's "server_uri" attribute is then set to use that scheme.

DIAGNOSTICS

Token needed for call to get_session
You are running a desktop app and you did not pass a token into get_session. You can create a token by calling create_token() or (better) login().

You are running a web app and the user hasn't logged in to Facebook for your web app. When the user does so, an auth_token will be returned (as a parameter) to your callback url. Use that auth_token for the session.

Don't know how to open browser for the system %s
The module doesn't know the command to use to open a browser on the given system. If you passed in "browser" to login(), it can use that string as the command to execute to open the login url.
Cannot use login method with web app
The login() method is not able to be used to sign in when using a web app. See the Facebook TOS A.9.iv.

CONFIGURATION AND ENVIRONMENT

WWW::Facebook::API::Auth requires no configuration files or environment variables.

DEPENDENCIES

See WWW::Facebook::API

INCOMPATIBILITIES

None.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to "[email protected]", or through the web interface at <http://rt.cpan.org>.

AUTHOR

David Romano "<[email protected]>"

LICENSE AND COPYRIGHT

Copyright (c) 2007-2010, David Romano "<[email protected]>". All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.