Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/h3poteto/ueberauth_hatena
Hatena strategy for Überauth
https://github.com/h3poteto/ueberauth_hatena
hatena oauth ueberauth ueberauth-strategies
Last synced: about 1 month ago
JSON representation
Hatena strategy for Überauth
- Host: GitHub
- URL: https://github.com/h3poteto/ueberauth_hatena
- Owner: h3poteto
- Created: 2019-10-07T12:53:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-30T15:37:33.000Z (6 months ago)
- Last Synced: 2024-09-05T09:49:24.361Z (2 months ago)
- Topics: hatena, oauth, ueberauth, ueberauth-strategies
- Language: Elixir
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ÜberauthHatena
> Hatena strategy for Überauth.## Installation
Add `:ueberauth_hatena` to list of your dependencies in `mix.exs`.```elixir
def deps do
[{:ueberauth_hatena, "~> 0.1"},
{:oauth, github: "tim/erlang-oauth"}]
end
```## Usage
1. Create your OAuth application at [Hatena Developer Center](https://www.hatena.ne.jp/oauth/develop).
2. Add Hatena to your Ueberauth configuration.
```elixir
config :ueberauth, Ueberauth,
providers: [
hatena: {Ueberauth.Strategy.Hatena, []}
]
```
3. Add consumer key and secret from your OAuth application. And set scope the application.
```elixir
config :ueberauth, Ueberauth.Strategy.Hatena.OAuth,
consumer_key: System.get_env("HATENA_CONSUMER_KEY"),
consumer_secret: System.get_env("HATENA_CONSUMER_SECRET"),
scope: "read_public,write_public"
```
4. Include the Ueberauth plug in your controller. And please implement request method and callback method.
```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauthdef request(conn, _params) do
...
enddef callback(conn, _params) do
...
end
end
```
5. Create reqeust and callback endpoint your router.
```elixir
scope "/auth", MyApp do
pipe_through :browserget "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```For an example implementation see the [Überauth Example application](https://github.com/ueberauth/ueberauth_example).
## License
The software is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).