Subscribed unsubscribe Subscribe Subscribe

Amon2-Auth-Site-Tumblr

soh335/Amon2-Auth-Site-Tumblr · GitHub

Amon2-Auth-Site-Hatenaとほとんど同じです。

#config
+ {
    Auth => {
        Tumblr => {
            consumer_key => "...",
            consumer_secret => "...",
        },
    },
}

#app
__PACKAGE__->load_plugin('Web::Auth', {
    module => 'Tumblr',
    on_error => sub {
        my ($c, $error_msg) = @_;
        die $error_msg;
    },
    on_finished => sub {
        my ($c, $token, $token_secret, $user) = @_;
        $c->session->set(tumblr => {
                user => $user,
                token => $token,
                token_secret => $token_secret,
            });
        $c->redirect('/');
    },
});