NAME

Amon2::Auth::Site::Google - Google auth integration for Amon2

SYNOPSIS

#add config
+{
    Auth => {
        Google => {
            client_id     => 'client id',
            client_secret => 'client secret',
            redirect_url  => 'redirect url',
            scope         => ['scope']
        }
    }
}

#add app
__PACKAGE__->load_plugin('Web::Auth', {
    module => 'Google',
    on_finished => sub {
        my ($c, $access_token, $refresh_token, $user) = @_;

        my $id       = $user->{id};       #e.g. 123456789
        my $name     = $user->{name};     #e.g. Nao Takanashi
        my $birthday = $user->{birthday}; #e.g. 1988-07-25

        $c->session->set(google => +{
            access_token  => $access_token,
            refresh_token => $refresh_token,
            user          => $user,
        });

        return $c->redirect('/');
    },
    on_error => sub {
        my ($c, $error_message) = @_;
        ...
    },
});

DESCRIPTION

Amon2::Auth::Site::Google is a Google authenticate module for Amon2

ATTRIBUTES

METHODS

SEE ALSO

LICENSE

Copyright (C) ntakanashi.

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

AUTHOR

ntakanashi