The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Amon2::Auth::Site::Twitter - Twitter integration for Amon2

SYNOPSIS

__PACKAGE__->load_plugin('Web::Auth', {
    module => 'Twitter',
    on_finished => sub {
        my ($c, $access_token, $access_token_secret, $user_id, $screen_name)
                = @_;
        $c->session->set('name' => $screen_name);
        $c->session->set('site' => 'twitter');
        return $c->redirect('/');
    }
});

DESCRIPTION

This is a twitter authentication module for Amon2. You can call a twitter APIs with this module.

ATTRIBUTES

consumer_key
consumer_secret

METHODS

$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.

on_error

on_error callback function is called if an error was occurred.

The arguments are following:

sub {
    my ($c, $error_message) = @_;
    ...
}
on_finished

on_finished callback function is called if an authentication was finished.

The arguments are following:

sub {
    my ($c, $access_token, $access_token_secret, $user_id, $screen_name)
            = @_;
    ...
}