Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Hatena Auth integration for Amon2
branch: master

Checking in changes prior to tagging of version 0.04.

Changelog diff is:

diff --git a/Changes b/Changes
index fad1d15..419723f 100644
--- a/Changes
+++ b/Changes
@@ -2,9 +2,13 @@ Revision history for Perl extension Amon2-Auth-Site-Hatena

 {{$NEXT}}

+0.04 2014-11-27T04:48:43Z
+    - Re-release for override UNAUTHORIZED flag (same as 0.03)
+
 0.03 2014-11-26T15:13:02Z

-    - original version
+    - depends on Woothee for parsing UserAgent
+    - migrate to Minilla

 0.02     2011-10-19
     - added smartphone, cellphone(jp) support.
latest commit b9c53adb22
Songmu Songmu authored
Failed to load latest commit information.
eg release it
lib/Amon2/Auth/Site
t migrate to minilla
.gitignore migrate to minilla
.travis.yml migrate to minilla
Build.PL migrate to minilla
Changes Checking in changes prior to tagging of version 0.04.
LICENSE migrate to minilla
META.json Checking in changes prior to tagging of version 0.04.
README.md Checking in changes prior to tagging of version 0.03.
cpanfile depend on Woothee for detecting ua
minil.toml migrate to minilla

README.md

NAME

Amon2::Auth::Site::Hatena - Hatena authentication integration for Amon2

SYNOPSIS

# config
+{
    Auth => {
        Hatena => {
            consumer_key    => 'your consumer key',
            consumer_secret => 'your consumer secret',
        }
    }
}

# app
__PACKAGE__->load_plugin('Web::Auth', {
    module   => 'Hatena',
    on_error => sub {
        my ($c, $error_message) = @_;
        ...
    },
    on_finished => sub {
        my ($c, $token, $token_secret, $user) = @_;

        my $name  = $user->{url_name};     #=> eg. antipop (id)
        my $nick  = $user->{display_name}; #=> eg. kentaro (nick)
        my $image = $user->{profile_image_url};

        $c->session->set(hatena => {
            user         => $user,
            token        => $token,
            token_secret => $token_secret,
        });

        $c->redirect('/');
    },
});

DESCRIPTION

This is a Hatena authentication module for Amon2. You can easily let users authenticate via Hatena OAuth API using this module.

ATTRIBUTES

  • consumer_key (required)
  • comsumer_secret (required)
  • scope (Default: [qw(read_public)])

    API scope in ArrayRef.

  • user_info (Default: true)

    If true, this module fetch user data immediately after authentication.

  • ua (Default: instance of OAuth::Lite::Consumer)

METHODS

  • $auth->auth_uri($c:Amon2::Web, $callback_uri:Str) : Str

    Returns an authenticate URI according to $ENV{HTTP_USER_AGENT}. It can be one of three for PC, smart phone, and JP cell phone.

  • $auth->callback($c:Amon2::Web, $callback:HashRef) : Plack::Response

    Process the authentication callback dispatching.

    • 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) = @_;
          ...
      }
      

      $user contains user information. If you set $auth-user_info> as a false value, authentication engine does not pass $user.

      See "app.psgi" in eg for details.

SEE ALSO

AUTHOR

Kentaro Kuribayashi kentarok@gmail.com

LICENSE

Copyright (C) Kentaro Kuribayashi

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

Something went wrong with that request. Please try again.