Amon2::Auth::Site::Facebook - Facebook integration for Amon2
__PACKAGE__->load_plugin('Web::Auth', { module => 'Facebook', on_finished => sub { my ($c, $token, $user) = @_; my $name = $user->{name} || die; $c->session->set('name' => $name); $c->session->set('site' => 'facebook'); return $c->redirect('/'); } });
This is a facebook authentication module for Amon2. You can call a facebook APIs with this module.
API scope in string.
Fetch user information after authenticate?
need fields of user information https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-public_profile
You can replace instance of LWP::UserAgent.
$auth->auth_uri($c:Amon2::Web, $callback_uri : Str) :Str
Get a authenticate URI.
$auth->callback($c:Amon2::Web, $callback:HashRef) : Plack::Response
Process the authentication callback dispatching.
$callback MUST have two keys.
$callback
on_error callback function is called if an error was occurred.
The arguments are following:
sub { my ($c, $error_message) = @_; ... }
on_finished callback function is called if an authentication was finished.
sub { my ($c, $access_token, $user) = @_; ... }
$user contains user information. This code contains a information like https://graph.facebook.com/19292868552.
$user
If you set $auth->user_info as false value, authentication engine does not pass $user.
$auth->user_info
To install Amon2::Auth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Amon2::Auth
CPAN shell
perl -MCPAN -e shell install Amon2::Auth
For more information on module installation, please visit the detailed CPAN module installation guide.