Skip to content
An elixir client library for Auth0
Branch: master
Clone or download
Latest commit 060a0fb May 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
fixture update envvar on travis ci Dec 22, 2017
lib Add custom_domain flag to override auth0.com suffixing of domain Apr 30, 2019
test run mix format Jul 12, 2018
.formatter.exs run mix format Jul 12, 2018
.gitignore add utils and config Jan 5, 2017
.iex.exs create mgmt token and handle expiry Feb 10, 2017
.travis.yml
README.md
mix.exs
mix.lock bump version May 2, 2019

README.md

Auth0Ex

Hex version Hex downloads Build Status

An elixir client library for Auth0

Installation

You can install the stable version from hex:

def deps do
[{:auth0_ex, "~> 0.3"}]
end

You can use github repo as your package source to use the latest source code but beware it might have breaking and unstable code:

def deps do
  [{:auth0_ex, github: "techgaun/auth0_ex"}]
end

Ensure auth0_ex is started before your application:

def application do
  [applications: [:auth0_ex]]
end

Configuration

Add a configuration block like below:

  • First option is to use management api client.

You can create non-interactive client for management api as described HERE. Once you do that, you should be able to grab client ID and client secret from the setting page for use with Auth0Ex. This is a recommended setup as Auth0Ex can recreate new access_token when the current one expires.

config :auth0_ex,
  domain: System.get_env("AUTH0_DOMAIN"),
  mgmt_client_id: System.get_env("AUTH0_MGMT_CLIENT_ID"),
  mgmt_client_secret: System.get_env("AUTH0_MGMT_CLIENT_SECRET"),
  http_opts: []
  • Second option is to use pre-created token with access to management API.
config :auth0_ex,
  domain: System.get_env("AUTH0_DOMAIN"),
  mgmt_token: System.get_env("AUTH0_MGMT_TOKEN"),
  http_opts: []

Notes

  • The v2 search_engine API is being deprecated by Auth0. User queries now specify search_engine=v3 by default. If for some reason you need the v2 engine you can set v2_search: true in your config block.
  • if you use pre-created management token, it will always be used for your requests_
  • AUTH0_DOMAIN should be entire tenant domain Auth0 provides. We fall back to adding auth0.com right now but that will be removed in future version. This allows us to use Auth0Ex in all tenant regions unlike the previous versions.
  • If you don't want auth0.com to be added, you can set config :auth0_ex, custom_domain: true

Export appropriate environment variable and you should be all set.

Please refer to the documentation for more details.

Authentication API

In addition to the management API resources, there is also a support for most used authentication APIs. Authentication API will use the same domain config you specify in the config above. If you wish to use Auth0Ex for authentication APIs only, all you need to specify is domain in config.

Author

You can’t perform that action at this time.