
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?
You can replace instance of LWP::UserAgent.

Get a authenticate URI.
Process the authentication callback dispatching.
$callback MUST have two keys.
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.
The arguments are following:
sub {
my ($c, $access_token, $user) = @_;
...
}
$user contains user information. This code contains a information like https://graph.facebook.com/19292868552.
If you set $auth->user_info as false value, authentication engine does not pass $user.