Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hatena/plack-middleware-hatenaoauth
Plack::Middleware::HatenaOAuth - provide a login endpoint for Hatena OAuth
https://github.com/hatena/plack-middleware-hatenaoauth
Last synced: about 17 hours ago
JSON representation
Plack::Middleware::HatenaOAuth - provide a login endpoint for Hatena OAuth
- Host: GitHub
- URL: https://github.com/hatena/plack-middleware-hatenaoauth
- Owner: hatena
- License: other
- Created: 2015-07-23T02:39:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T09:53:49.000Z (almost 5 years ago)
- Last Synced: 2024-04-15T00:05:00.190Z (7 months ago)
- Language: Perl
- Size: 30.3 KB
- Stars: 1
- Watchers: 42
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Actions Status](https://github.com/hatena/Plack-Middleware-HatenaOAuth/workflows/test/badge.svg)](https://github.com/hatena/Plack-Middleware-HatenaOAuth/actions)
# NAMEPlack::Middleware::HatenaOAuth - provide a login endpoint for Hatena OAuth
# SYNOPSIS
use Plack::Builder;
use Plack::Session;my $app = sub {
my $env = shift;
my $session = Plack::Session->new($env);
my $user_info = $session->get('hatenaoauth_user_info') || {};
my $user_name = $user_info->{url_name};
return [
200,
[ 'Content-Type' => 'text/html' ],
[
"Hello",
$user_name
? "Hello, id:$user_name !"
: "Login"
],
];
};builder {
enable 'Session';
enable 'Plack::Middleware::HatenaOAuth',
consumer_key => 'vUarxVrr0NHiTg==',
consumer_secret => 'RqbbFaPN2ubYqL/+0F5gKUe7dHc=',
login_path => '/login',
# ua => LWP::UserAgent->new(...), # optional
;
$app;
};# DESCRIPTION
This middleware adds an endpoint to start Hatena OAuth authentication
flow to your Plack app.# CONFIGURATIONS
- consumer\_key
- consumer\_secretconsumer_key => 'vUarxVrr0NHiTg=='
consumer_secret => 'RqbbFaPN2ubYqL/+0F5gKUe7dHc='A consumer key and consumer secret registered on [the setting page
for developers](http://www.hatena.ne.jp/oauth/develop). Follow the
instructions in [the documentation on the devloper
center](http://developer.hatena.ne.jp/en/documents/auth/apis/oauth/consumer)
for registration.- login\_path
login_path => '/login'
An endpoint for OAuth login, which is added to your Plack app.
- ua
ua => LWP::UserAgent->new(...)
A user agent to make a remote access to the OAuth server.
# LICENSE
Copyright (C) Hatena Co., Ltd..
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.# AUTHOR
mechairoi
INA Lintaro