Auth0Api

Management API for Auth0

Installation

The package can be installed by adding auth0_api to your list of dependencies in mix.exs:

def deps do
  [
    {:auth0_api, "~> 2.2.0"}
  ]
end

Basic Usage

  1. Set Domain, Client ID and Client Secret:
config = %Auth0.Config{
  domain: "xxx.auth0.com",
  client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  client_secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
# or API Token instead
config = %Auth0.Config{
  domain: "xxx.auth0.com",
  api_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

or You can use environment variable with keys below:

  1. Call Management API.

Normal Usage

params = %{
  include_totals: true
}
Auth0.Api.Management.get_users(params, config)

Raw Usage

body = %{}
headers = %{}
Auth0.Common.Management.Http.raw_request(:get, "/api/v2/users?include_totals=true", body, headers, config)

Rate Limiting

The library handles Auth0's rate limiting automatically. When a 429 Too Many Requests response is received, it checks the Retry-After header and waits for the specified duration before retrying. If the header is missing, it falls back to an exponential backoff strategy.

Deprecations

Release Notes

2.3.0

2.2.0

2.1.0

The docs can be found at https://hexdocs.pm/auth0_api.