Überauth Auth0
Auth0 OAuth2 strategy for Überauth.
Installation
-
Set up your Auth0 application at Auth0 dashboard
-
Add
ueberauth_auth0to your list of dependencies inmix.exs:
```elixir
def deps do
[{:ueberauth_auth0, "~> 0.1"}]
end
```
- Ensure
ueberauth_auth0is started before your application:
```elixir
def application do
[applications: [:ueberauth_auth0]]
end
```
- Add Auth0 to your Überauth configuration:
```elixir
config :ueberauth, Ueberauth,
providers: [
auth0: {Ueberauth.Strategy.Auth0, []}
]
```
- Update your provider configuration:
```elixir
config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,
domain: System.get_env("AUTH0_DOMAIN"),
client_id: System.get_env("AUTH0_CLIENT_ID"),
client_secret: System.get_env("AUTH0_CLIENT_SECRET")
```
- Include the Überauth plug in your controller:
```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauth
...
end
```
- Create the request and callback routes if you haven't already:
```elixir
scope "/auth", MyApp do
pipe_through :browser
get "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```
License
Please see LICENSE for licensing details.