Mojolicious::Plugin::Web::Auth - Authentication plugin for Mojolicious
# Mojolicious $self->plugin('Web::Auth' module => 'Twitter', key => 'Twitter consumer key', secret => 'Twitter consumer secret', on_finished => sub { my ( $c, $access_token, $access_secret ) = @_; ... }, ); # Mojolicious::Lite plugin 'Web::Auth', module => 'Twitter', key => 'Twitter consumer key', secret => 'Twitter consumer secret', on_finished => sub { my ( $c, $access_token, $access_secret ) = @_; ... }; ### default authentication endpoint: /auth/{moniker}/authenticate # e.g.) # /auth/twitter/authenticate # /auth/facebook/authenticate ### default callback endpoint: /auth/{moniker}/callback # e.g.) # /auth/twitter/callback # /auth/facebook/callback
Mojolicious::Plugin::Web::Auth is authentication plugin for Mojolicious.
Mojolicious::Plugin::Directory inherits all methods from Mojolicious::Plugin.
Mojolicious::Plugin::Web::Auth supports the following options.
module
This is a module name for authentication plugins.
Dropbox, Facebook, Github, Google, Instagram, Twitter.
key
consumer key
secret
consumer secret
scope
optional. OAuth 2.0 only.
# Facebook plugin 'Web::Auth', module => 'Facebook', key => 'Facebook App ID', secret => 'Facebook App Secret', scope => 'email,user_birthday', on_finished => sub { my ( $c, $access_token, $user_info ) = @_; ... };
on_finished
# Mojolicious::Lite plugin 'Web::Auth', module => 'Twitter', key => 'Twitter consumer key', secret => 'Twitter consumer secret', on_finished => sub { my ( $c, $access_token, $access_secret, $user_ino ) = @_; ... };
This is a callback when authentication was finished.
OAuth 1.0(A)
Dropbox, Twitter, etc.
OAuth 2.0
Facebook, Github, Google, Instagram, etc.
on_error
This is a callback when authentication was errored.
hayajo <hayajo@cpan.org>
Mojolicious, Amon2::Auth
To install Mojolicious::Plugin::Web::Auth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Web::Auth
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Web::Auth
For more information on module installation, please visit the detailed CPAN module installation guide.