https://github.com/achedeuzot/ueberauth_auth0
Auth0 OAuth2 strategy for Überauth.
https://github.com/achedeuzot/ueberauth_auth0
auth0 elixir hacktoberfest ueberauth ueberauth-strategies
Last synced: 17 days ago
JSON representation
Auth0 OAuth2 strategy for Überauth.
- Host: GitHub
- URL: https://github.com/achedeuzot/ueberauth_auth0
- Owner: achedeuzot
- License: mit
- Created: 2016-06-16T04:24:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-03T23:58:32.000Z (about 2 years ago)
- Last Synced: 2025-04-04T08:04:30.475Z (18 days ago)
- Topics: auth0, elixir, hacktoberfest, ueberauth, ueberauth-strategies
- Language: Elixir
- Homepage: https://hexdocs.pm/ueberauth_auth0
- Size: 235 KB
- Stars: 71
- Watchers: 3
- Forks: 46
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Überauth Auth0
[](https://github.com/achedeuzot/ueberauth_auth0/actions?query=workflow%3Atests+branch%3Amaster)
[](https://coveralls.io/github/achedeuzot/ueberauth_auth0?branch=master)
[](https://hex.pm/packages/ueberauth_auth0)
[](https://hexdocs.pm/ueberauth_auth0/)
[](https://hex.pm/packages/ueberauth_auth0)
[](https://github.com/achedeuzot/ueberauth_auth0/blob/master/LICENSE.md)
[](https://github.com/achedeuzot/ueberauth_auth0/commits/master)> Auth0 OAuth2 strategy for Überauth.
## Installation
1. Set up your Auth0 application at [Auth0 dashboard](https://manage.auth0.com/#/applications).
2. Add `:ueberauth_auth0` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ueberauth_auth0, "~> 2.0"}
]
end
```3. Ensure `ueberauth_auth0` is started before your application:
```elixir
def application do
[
applications: [:ueberauth_auth0]
]
end
```4. Add Auth0 to your Überauth configuration:
```elixir
config :ueberauth, Ueberauth,
providers: [
auth0: {Ueberauth.Strategy.Auth0, []}
],
# If you wish to customize the OAuth serializer,
# add the line below. Defaults to Jason.
json_library: Poison
```**or** with per-app config:
```elixir
config :my_app, Ueberauth,
providers: [
auth0: {Ueberauth.Strategy.Auth0, [otp_app: :my_app]}
]
```5. 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")
```**or** with per-app config:
```elixir
config :my_app, 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")
```See the `Ueberauth.Strategy.Auth0` module docs for more
configuration options.6. Include the Überauth plug in your controller:
```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauth
...
end
```**or** with per-app config:
```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauth, otp_app: :my_app
...
end
```7. Create the request and callback routes if you haven't already:
```elixir
scope "/auth", MyApp do
pipe_through :browserget "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```8. You controller needs to implement callbacks to deal with Ueberauth.Auth and Ueberauth.Failure responses.
For an example implementation see the [Überauth Example](https://github.com/ueberauth/ueberauth_example) application.
## Learn about OAuth2
[OAuth2 explained with cute shapes](https://engineering.backmarket.com/oauth2-explained-with-cute-shapes-7eae51f20d38)## Copyright and License
Copyright (c) 2015 Son Tran-Nguyen \
Copyright (c) 2020 Klemen SeverThis library is released under the MIT License. See the [LICENSE.md](./LICENSE.md) file
for further details.