ÜberauthHatena
Hatena strategy for Überauth.
Installation
Add :ueberauth_hatena to list of your dependencies in mix.exs.
def deps do
[{:ueberauth_hatena, "~> 0.1"},
{:oauth, github: "tim/erlang-oauth"}]
end
Usage
- Create your OAuth application at Hatena Developer Center.
- Add Hatena to your Ueberauth configuration.
config :ueberauth, Ueberauth,providers: [hatena: {Ueberauth.Strategy.Hatena, []}]
- Add consumer key and secret from your OAuth application. And set scope the application.
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"
- Include the Ueberauth plug in your controller. And please implement request method and callback method.
defmodule MyApp.AuthController douse MyApp.Web, :controllerplug Ueberauthdef request(conn, _params) do...enddef callback(conn, _params) do...endend
- Create reqeust and callback endpoint your router.
scope "/auth", MyApp dopipe_through :browserget "/:provider", AuthController, :requestget "/:provider/callback", AuthController, :callbackend
For an example implementation see the Überauth Example application.
License
The software is available as open source under the terms of the MIT License.