Introduction

The Authentication API enables you to manage all aspects of user identity when you use Auth0. It offers endpoints so your users can log in, sign up, log out, access APIs, and more.

The API supports various identity protocols, like OpenID Connect, OAuth 2.0, and SAML.

This API is designed for people who feel comfortable integrating with RESTful APIs. If you prefer a more guided approach check out our Quickstarts or our Libraries.

Base URL

The Authentication API is served over HTTPS. All URLs referenced in the documentation have the following base: https://YOUR_AUTH0_DOMAIN

Authentication methods

There are three ways to authenticate with this API:

  • with an OAuth2 Access Token in the Authorization request header field (which uses the Bearer authentication scheme to transmit the Access Token)
  • with your Client ID and Client Secret credentials
  • only with your Client ID

Each endpoint supports only one option.

OAuth2 token

In this case, you have to send a valid Access Token in the Authorization header, using the Bearer authentication scheme. An example is the Get User Info endpoint. In this scenario, you get an Access Token when you authenticate a user, and then you can make a request to the Get User Info endpoint, using that token in the Authorization header, in order to retrieve the user's profile.

Client ID and Client Secret

In this case, you have to send your Client ID and Client Secret information in the request JSON body. An example is the Revoke Refresh Token endpoint. This option is available only for confidential applications (such as applications that are able to hold credentials in a secure way without exposing them to unauthorized parties).

Client ID

For public applications (such as applications that cannot hold credentials securely, like SPAs or mobile apps) we offer some endpoints that can be accessed using only the Client ID. An example is the Implicit Grant.

Parameters

For GET requests, any parameters not specified as a segment in the path can be passed as an HTTP query string parameter:

GET https://YOUR_AUTH0_DOMAIN/some-endpoint?param=value&param=value

For POST requests, parameters not included in the URL should be encoded as JSON with a Content-Type of application/json:

curl --request POST --url 'https://YOUR_AUTH0_DOMAIN/some-endpoint' --header 'content-type: application/json' --data '{"param": "value", "param": "value"}'

An exception to that is the SAML IdP-Initiated SSO Flow that uses both a query string parameter and a x-www-form-urlencoded value.

Code samples

For each endpoint you will find sample snippets you can use, in three available formats:

  • HTTP request
  • Curl command
  • JavaScript: depending on the endpoint each snippet may use the Auth0.js library, Node.js code or simple JavaScript

Testing

You can test the endpoints using either the Authentication API Debugger or our preconfigured Postman collection. For some endpoints both options are available.

Test with the Authentication API Debugger

The Authentication API Debugger is an Auth0 extension you can use to test several endpoints of the Authentication API.

If it's the first time you use it, you have to install it using the dashboard. Once you do you are ready to configure your app's settings and run your tests.

Note that its URL varies according to your tenant's region:

Test with Postman

If you are working with APIs, you are probably already familiar with Postman, a development tool that enables you to configure and run API requests.

We have preconfigured a collection that you can download. You will have to configure some environment variables to customize the requests. For more information on this, refer to Using the Auth0 API with our Postman Collections.

Errors

When an error occurs, you will receive an error object. All error objects have an error code and an error description so that your applications can tell what the problem is.

If you get an 4xx HTTP response code, then you can assume that there is a bad request from your end. In this case, check the Standard Error Responses for more context.

5xx errors suggest a problem on Auth0's end, so in this case, check Auth0 Status Page and @auth0status on Twitter to see how our systems are doing.

In any other case you can use our support options.

Rate limiting

The Authentication API is subject to rate limiting. The limits differ per endpoint.

If you exceed the provided rate limit for a given endpoint, you will receive the 429 Too Many Requests response with the following message: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.

For details on rate limiting, refer to Auth0 API Rate Limit Policy.

Note that for database connections Auth0 limits certain types of repeat login attempts depending on the user account and IP address. For details, refer to Rate Limits on User/Password Authentication.

Support

If you have problems or need help with your case you can always reach out to our Support.

Note that if you have a free subscription plan, and you are not in your 22-day trial period, you will not be able to access or open tickets in the Support Center. In this case, you can seek support through the Auth0 Community. For more info on our support program, refer to Support Options.

Login

Social

GET https://YOUR_AUTH0_DOMAIN/authorize?
  response_type=code|token&
  client_id=YOUR_CLIENT_ID&
  connection=CONNECTION&
  redirect_uri=https://YOUR_APP/callback&
  state=STATE&
  ADDITIONAL_PARAMETERS
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize app
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  // Trigger login with google
  webAuth.authorize({
    connection: 'google-oauth2'
  });

  // Trigger login with github
  webAuth.authorize({
    connection: 'github'
  });

  // Trigger login popup with twitter
  webAuth.popup.authorize({
    connection: 'twitter'
  });
</script>
GET /authorize

Use this endpoint to authenticate a user with a social provider. It will return a 302 redirect to the social provider specified in connection.

Social connections only support browser-based (passive) authentication because most social providers don't allow a username and password to be entered into applications that they don't own. Therefore, the user will be redirected to the provider's sign in page.

Request Parameters

Parameter Description
response_type
Required
Use code for server side flows and token for application side flows
client_id
Required
The client_id of your application
connection The name of a social identity provider configured to your application, for example google-oauth2 or facebook. If null, it will redirect to the Auth0 Login Page and show the Login Widget.
redirect_uri
Required
The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
state
Recommended
An opaque value the applications adds to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks.
ADDITIONAL_PARAMETERS Append any additional parameter to the end of your request, and it will be sent to the provider. For example, access_type=offline (for Google Refresh Tokens) , display=popup (for Windows Live popup mode).

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (the name of the social connection to use).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, click OAuth2 / OIDC Login.

Remarks

  • The redirect_uri value must be specified as a valid callback URL under your Application's Settings.

  • If response_type=token, after the user authenticates on the provider, it will redirect to your application callback URL passing the access_token and id_token in the address location.hash. This is used for Single Page Apps and also on Native Mobile SDKs.

  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

More Information

Database/AD/LDAP (Passive)

GET https://YOUR_AUTH0_DOMAIN/authorize?
  response_type=code|token&
  client_id=YOUR_CLIENT_ID&
  connection=CONNECTION&
  redirect_uri=https://YOUR_APP/callback&
  state=STATE
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize app
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  // Calculate URL to redirect to
  var url = webAuth.client.buildAuthorizeUrl({
    clientID: 'YOUR_CLIENT_ID', // string
    responseType: 'token', // code or token
    redirectUri: 'https://YOUR_APP/callback',
    state: 'YOUR_STATE'
  });
  
  // Redirect to url
  // ...
</script>
GET /authorize

Use this endpoint for browser based (passive) authentication. It returns a 302 redirect to the Auth0 Login Page that will show the Login Widget where the user can login with email and password.

Request Parameters

Parameter Description
response_type
Required
Use code for server side flows and token for application side flows.
client_id
Required
The client_id of your application.
connection The name of the connection configured to your application. If null, it will redirect to the Auth0 Login Page and show the Login Widget using the first database connection.
redirect_uri
Required
The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
state
Recommended
An opaque value the applications adds to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (the name of the social connection to use).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, click OAuth2 / OIDC Login.

Remarks

  • The redirect_uri value must be specified as a valid callback URL under your Application's Settings.
  • If response_type=token, after the user authenticates, it will redirect to your application callback URL passing the access_token and id_token in the address location.hash. This is used for Single Page Apps and also on Native Mobile SDKs.
  • The main difference between passive and active authentication is that the former happens in the browser through the Auth0 Login Page and the latter can be invoked from anywhere (a script, server to server, and so forth).
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

More Information

Enterprise (SAML and Others)

GET https://YOUR_AUTH0_DOMAIN/authorize?
  response_type=code|token&
  client_id=YOUR_CLIENT_ID&
  connection=CONNECTION&
  redirect_uri=https://YOUR_APP/callback&
  state=STATE
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  // Trigger login using redirect with credentials to enterprise connections 
  webAuth.redirect.loginWithCredentials({
    connection: 'Username-Password-Authentication',
    username: 'testuser',
    password: 'testpass',
    scope: 'openid'
  });

  // Trigger login using popup mode with credentials to enterprise connections
  webAuth.popup.loginWithCredentials({
    connection: 'Username-Password-Authentication',
    username: 'testuser',
    password: 'testpass',
    scope: 'openid'
  });
</script>
GET /authorize

Use this endpoint for passive authentication. It returns a 302 redirect to the SAML Provider (or Windows Azure AD and the rest, as specified in the connection) to enter their credentials.

Request Parameters

Parameter Description
response_type
Required
Use code for server side flows, token for application side flows.
client_id
Required
The client_id of your application.
connection The name of the connection configured to your application. If null, it will redirect to the Auth0 Login Page and show the Login Widget using the first database connection.
redirect_uri
Required
The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
state
Recommended
An opaque value the applications adds to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (the name of the social connection to use).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, click OAuth2 / OIDC Login.

Remarks

  • If no connection is specified, it will redirect to the Login Page and show the Login Widget.
  • The redirect_uri value must be specified as a valid callback URL under your Application's Settings.
  • If response_type=token, after the user authenticates, it will redirect to your application callback URL passing the access_token and id_token in the address location.hash. This is used for Single Page Apps and also on Native Mobile SDKs.
  • Additional parameters can be sent that will be passed to the provider.
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.
  • In order to use loginWithCredentials, auth0.js needs to make cross-origin calls. Check the Cross-Origin Authentication article to understand the limitations of this approach.

More Information

Logout

GET https://YOUR_AUTH0_DOMAIN/v2/logout?
  client_id=YOUR_CLIENT_ID&
  returnTo=LOGOUT_URL
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/v2/logout' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "returnTo":"LOGOUT_URL"}'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  webAuth.logout({
    returnTo: 'YOUR_LOGOUT_URL',
    client_id: 'YOUR_CLIENT_ID'
  });
</script>
GET /v2/logout

Use this endpoint to logout a user. If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:

Request Parameters

Parameter Description
returnTo URL to redirect the user after the logout.
client_id The client_id of your application.
federated Add this querystring parameter to the logout URL, to log the user out of their identity provider, as well: https://YOUR_AUTH0_DOMAIN/v2/logout?federated.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (the name of the social connection to use).

  2. Copy the Callback URL and set it as part of the Allowed Logout URLs of your Application Settings.

  3. At the Other Flows tab, click Logout, or Logout (Federated) to log the user out of the identity provider as well.

Remarks

  • Logging the user out of their identity provider is not common practice, so think about the user experience before you use the federated querystring parameter.
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

More Information

Passwordless

Passwordless connections do not require the user to remember a password. Instead, another mechanism is used to prove identity, such as a one-time code sent through email or SMS, every time the user logs in.

POST https://YOUR_AUTH0_DOMAIN/passwordless/start
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "connection": "email|sms",
  "email": "EMAIL", //set for connection=email
  "phone_number": "PHONE_NUMBER", //set for connection=sms
  "send": "link|code", //if left null defaults to link
  "authParams": { // any authentication parameters that you would like to add
    "scope": "openid",
    "state": "YOUR_STATE"
  }
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/passwordless/start' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "connection":"email|sms", "email":"EMAIL", "phone_number":"PHONE_NUMBER", "send":"link|code", "authParams":{"scope": "openid","state": "YOUR_STATE"}}'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });

  // Send a verification code using email
  webAuth.passwordlessStart({
      connection: 'email',
      send: 'code',
      email: 'USER_EMAIL'
    }, function (err,res) {
      // handle errors or continue
    }
  );

  // Send a link using email
  webAuth.passwordlessStart({
      connection: 'email',
      send: 'link',
      email: 'USER_EMAIL'
    }, function (err,res) {
      // handle errors or continue
    }
  );

  // Send a verification code using SMS
  webAuth.passwordlessStart({
      connection: 'sms',
      send: 'code',
      phoneNumber: 'USER_PHONE_NUMBER'
    }, function (err,res) {
      // handle errors or continue
    }
  );
</script>
POST /passwordless/start

You have three options for passwordless authentication:

  • Send a verification code using email.
  • Send a link using email.
  • Send a verification code using SMS.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application.
connection
Required
How to send the code/link to the user. Use email to send the code/link using email, or sms to use SMS.
email Set this to the user's email address, when connection=email.
phone_number Set this to the user's phone number, when connection=sms.
send Use link to send a link or code to send a verification code. If null, a link will be sent.
authParams Use this to append or override the link parameters (like scope, redirect_uri, protocol, response_type), when you send a link using email.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • If you sent a verification code, using either email or SMS, after you get the code, you have to authenticate the user using the /oauth/ro endpoint, using email or phone_number as the username, and the verification code as the password.
  • This endpoint is designed to be called from the client-side, and has a rate limit of 50 requests per hour per IP.
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /passwordless/start.

More Information

Authenticate User

POST https://YOUR_AUTH0_DOMAIN/oauth/ro
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "connection": "email|sms",
  "grant_type": "password",
  "username": "EMAIL|PHONE", //email or phone number
  "password": "VERIFICATION_CODE", //the verification code
  "scope": "SCOPE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/ro' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "connection":"email|sms", "grant_type":"password", "username":"EMAIL|PHONE", "password":"VERIFICATION_CODE", "scope":"SCOPE"}'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });

  // Verify code sent via email
  webAuth.passwordlessLogin({
      connection: 'email',
      email: 'USER_EMAIL',
      verificationCode: 'VERIFICATION_CODE_SENT'
    }, function (err,res) {
      // handle errors or continue
    }
  );

  // Verify code sent within link using email
  webAuth.passwordlessLogin({
      connection: 'email',
      email: 'USER_EMAIL',
      verificationCode: 'VERIFICATION_CODE_SENT_WITHIN_LINK'
    }, function (err,res) {
      // handle errors or continue
    }
  );

  // Verify code sent via SMS
  webAuth.passwordlessLogin({
      connection: 'sms',
      phoneNumber: 'USER_PHONE_NUMBER',
      verificationCode: 'VERIFICATION_CODE_SENT'
    }, function (err,res) {
      // handle errors or continue
    }
  );
</script>
POST /oauth/ro

This feature is disabled by default for new tenants as of 8 June 2017. Please see Application Grant Types for more information.

Once you have a verification code, use this endpoint to login the user with their phone number/email and verification code. This is active authentication, so the user must enter the code in your app.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application.
connection
Required
Use sms or email (should be the same as POST /passwordless/start)
grant_type
Required
Use password
username
Required
The user's phone number if connection=sms, or the user's email if connection=email.
password
Required
The user's verification code.
scope Use openid to get an id_token, or openid profile email to include also user profile information in the id_token.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (use sms or email).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set Username to the user's phone number if connection=sms, or the user's email if connection=email, and Password to the user's verification code. Click Resource Owner Endpoint.

Remarks

  • The profile scope value requests access to the End-User's default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.
  • The email scope value requests access to the email and email_verified Claims.
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /oauth/ro.

More Information

Signup

POST https://YOUR_AUTH0_DOMAIN/dbconnections/signup
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "email": "EMAIL",
  "password": "PASSWORD",
  "connection": "CONNECTION",
  "user_metadata": { plan: 'silver', team_id: 'a111' }
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/dbconnections/signup' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "email":"test.account@signup.com", "password":"PASSWORD", "connection":"CONNECTION", "user_metadata":{ "plan": "silver", "team_id": "a111" }}'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize client
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  webAuth.signup({ 
    connection: 'CONNECTION', 
    email: 'EMAIL', 
    password: 'PASSWORD',
    user_metadata: { plan: 'silver', team_id: 'a111' }
  }, function (err) { 
    if (err) return alert('Something went wrong: ' + err.message); 
      return alert('success signup without login!') 
  });
</script>

RESPONSE SAMPLE:

{
  "_id": "58457fe6b27...",
  "email_verified": false,
  "email": "test.account@signup.com",
  "user_metadata":{"plan":"silver","team_id":"a111"}
}
POST /dbconnections/signup

Given a user's credentials, and a connection, this endpoint will create a new user using active authentication.

This endpoint only works for database connections.

Request Parameters

Parameter Description
client_id
Required
The client_id of your client.
email
Required
The user's email address.
password
Required
The user's desired password.
connection
Required
The name of the database configured to your client.
user_metadata The user metadata to be associated with the user. If set, the field must be an object containing no more than ten properties. Property names can have a maximum of 100 characters, and property values must be strings of no more than 500 characters.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

More Information

Change Password

POST https://YOUR_AUTH0_DOMAIN/dbconnections/change_password
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "email": "EMAIL",
  "password": "",
  "connection": "CONNECTION",
}
curl --request POST \
  --url https://YOUR_AUTH0_DOMAIN/dbconnections/change_password \
  --header 'content-type: application/json' \
  --data '{"client_id": "YOUR_CLIENT_ID","email": "EMAIL", "password": "", "connection": "CONNECTION"}'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  webAuth.changePassword({
    connection: 'CONNECTION',
    email:   'EMAIL'
  }, function (err, resp) {
    if(err){
      console.log(err.message);
    }else{
      console.log(resp);
    }
  });
</script>
POST /dbconnections/change_password

RESPONSE SAMPLE:

"We've just sent you an email to reset your password."

Given a user's email address and a connection, Auth0 will send a change password email.

This endpoint only works for database connections.

Request Parameters

Parameter Description
client_id
Required
The client_id of your client.
email
Required
The user's email address.
password The new password. See the next paragraph for the case when a password can be set.
connection
Required
The name of the database connection configured to your client.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • If you are using Lock version 9 and above, do not set the password field or you will receive a password is not allowed error. You can only set the password if you are using Lock version 8.
  • If a password is provided, when the user clicks on the confirm password change link, the new password specified in this POST will be set for this user.
  • If a password is NOT provided, when the user clicks on the password change link they will be redirected to a page asking them for a new password.
  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.
  • This endpoint will return three HTTP Response Headers, that provide relevant data on its rate limits:
    • X-RateLimit-Limit: Number of requests allowed per minute.
    • X-RateLimit-Remaining: Number of requests available. Each new request reduces this number by 1. For each minute that passes, requests are added back, so this number increases by 1 each time.
    • X-RateLimit-Reset: Remaining time until the rate limit (X-RateLimit-Limit) resets. The value is in UTC epoch seconds.

More Information

User Profile

Get User Info

GET https://YOUR_AUTH0_DOMAIN/userinfo
Authorization: 'Bearer {ACCESS_TOKEN}'
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/userinfo' \
  --header 'Authorization: Bearer {ACCESS_TOKEN}' \
  --header 'Content-Type: application/json'
// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize the Auth0 application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
  
  // Parse the URL and extract the access_token
  webAuth.parseHash(window.location.hash, function(err, authResult) {
    if (err) {
      return console.log(err);
    }
    webAuth.client.userInfo(authResult.accessToken, function(err, user) {
        // This method will make a request to the /userinfo endpoint 
        // and return the user object, which contains the user's information, 
        // similar to the response below.
    });
  });
</script>

RESPONSE SAMPLE:

{
  "email_verified": false,
  "email": "test.account@userinfo.com",
  "updated_at": "2016-12-05T15:15:40.545Z",
  "name": "test.account@userinfo.com",
  "picture": "https://s.gravatar.com/avatar/dummy.png",
  "user_id": "auth0|58454...",
  "nickname": "test.account",
  "created_at": "2016-12-05T11:16:59.640Z",
  "sub": "auth0|58454..."
}
GET /userinfo

Given the Auth0 Access Token obtained during login, this endpoint returns a user's profile.

This endpoint will work only if openid was granted as a scope for the access_token.

Request Parameters

Parameter Description
access_token
Required
The Auth0 access_token obtained during login.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.
  • The auth0.js parseHash method, requires that your tokens are signed with RS256, rather than HS256. For more information about this, check the Auth0.js v8 Migration Guide.
  • If you want this endpoint to return user_metadata or other custom information, you can use rules. For more information refer to User profile claims and scope.
  • This endpoint will return three HTTP Response Headers, that provide relevant data on its rate limits:
    • X-RateLimit-Limit: Number of requests allowed per minute.
    • X-RateLimit-Remaining: Number of requests available. Each new request reduces this number by 1. For each minute that passes, requests are added back, so this number increases by 1 each time.
    • X-RateLimit-Reset: Remaining time until the rate limit (X-RateLimit-Limit) resets. The value is in UTC epoch seconds.
  • The Email claim returns a snapshot of the email at the time of login
  • Standard claims (other than email) return the latest value (unless the value comes from an external IdP)
  • Custom claims return a snapshot of the value at the time of login
  • To access the most up-to-date values for the email or custom claims, you must get new tokens. You can log in using silent authentication (where the prompt parameter for your call to the authorize endpoint equals none)
  • To access the most up-to-date values for standard claims that were changed using an external IdP (for example, the user changed their email address in Facebook)., you must get new tokens. Log in again using the external IdP, but not with silent authentication.

More Information

Multifactor Authentication

The Multifactor Authentication (MFA) API endpoints allow you to enforce MFA when users interact with the Token endpoints, as well enroll and manage user authenticators.

First, request a challenge based on the challenge types supported by the application and user. If you know that one-time password (OTP) is supported, you can skip the challenge request.

Next, verify the multifactor authentication using the /oauth/token endpoint and the specified challenge type: a one-time password (OTP), a recovery code, or an out-of-band (OOB) challenge.

For more information, check out:

Challenge request

POST https://YOUR_AUTH0_DOMAIN/mfa/challenge
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "mfa_token": "MFA_TOKEN",
  "challenge_type": "oob|otp"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/mfa/challenge' \
  --header 'content-type: application/json' \
  --data '{"mfa_token":"MFA_TOKEN", "challenge_type":"oob otp", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/mfa/challenge',
  headers: { 'content-type': 'application/json' },
  body:
   { mfa_token: 'MFA_TOKEN',
     challenge_type: 'oob otp',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE FOR OTP:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "challenge_type":"otp",
}

RESPONSE SAMPLE FOR OOB WITHOUT BINDING METHOD:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "challenge_type":"oob",
  "oob_code": "abcde...dasg"
}

RESPONSE SAMPLE FOR OOB WITH BINDING METHOD:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "challenge_type":"oob",
  "binding_method":"prompt",
  "oob_code": "abcde...dasg"
}
POST /mfa/challenge

Request a challenge based on the challenge types supported by the application and user.

The challenge_type is how the user will get the challenge and prove possession. Supported challenge types include:

  • otp: for one-time password (OTP)
  • oob: for SMS messages or out-of-band (OOB)

If OTP is supported by the user and you don't want to request a different factor, you can skip the challenge request and verify the multifactor authentication with a one-time password.

Request Parameters

Parameter Description
mfa_token
Required
The token received from mfa_required error.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
challenge_type A whitespace-separated list of the challenges types accepted by your application. Accepted challenge types are oob or otp. Excluding this parameter means that your client application accepts all supported challenge types.
oob_channel (early access users only) The channel to use for OOB. Can only be provided when challenge_type is oob. Accepted channel types are sms or auth0. Excluding this parameter means that your client application will accept all supported OOB channels.
authenticator_id (early access users only) The ID of the authenticator to challenge. You can get the ID by querying the list of available authenticators for the user as explained on List authenticators below.

Remarks

  • This endpoint does not support enrollment; the user must be enrolled with the preferred method before requesting a challenge.
  • Auth0 chooses the challenge type based on the application's supported types and types the user is enrolled with.
  • An unsupported_challenge_type error is returned if your application does not support any of the challenge types the user has enrolled with.
  • An unsupported_challenge_type error is returned if the user is not enrolled.
  • (early access only) If the user is not enrolled, you will get a association_required error, indicating the user needs to enroll to use MFA. Check Add an authenticator below on how to proceed.

More information

Verify with one-time password (OTP)

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "mfa_token": "MFA_TOKEN",
  "grant_type": "http://auth0.com/oauth/grant-type/mfa-otp",
  "otp": "OTP_CODE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"mfa_token":"MFA_TOKEN", "otp":"OTP_CODE", "grant_type": "http://auth0.com/oauth/grant-type/mfa-otp", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { mfa_token: 'MFA_TOKEN',
     otp: 'OTP_CODE',
     grant_type: 'http://auth0.com/oauth/grant-type/mfa-otp',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE FOR OTP:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}
POST /oauth/token

Verifies multifactor authentication (MFA) using a one-time password (OTP).

To verify MFA with an OTP, prompt the user to get the OTP code, then make a request to the /oauth/token endpoint. The request must have the OTP code, the mfa_token you received (from the mfa_required error), and the grant_type set to http://auth0.com/oauth/grant-type/mfa-otp.

The response is the same as responses for password or http://auth0.com/oauth/grant-type/password-realm grant types.

Request parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For OTP MFA use http://auth0.com/oauth/grant-type/mfa-otp.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
mfa_token
Required
The mfa_token you received from mfa_required error.
otp
Required
OTP Code provided by the user.

More informationm

Verify with out-of-band (OOB)

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "mfa_token": "MFA_TOKEN",
  "grant_type": "http://auth0.com/oauth/grant-type/mfa-oob",
  "oob_code": "OOB_CODE",
  "binding_code": "BINDING_CODE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"mfa_token":"MFA_TOKEN", "oob_code": "OOB_CODE", "binding_code": "BINDING_CODE", "grant_type": "http://auth0.com/oauth/grant-type/mfa-oob", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { mfa_token: 'MFA_TOKEN',
     oob_code: "OOB_CODE",
     binding_code: "BINDING_CODE"
     grant_type: 'http://auth0.com/oauth/grant-type/mfa-oob',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE FOR PENDING CHALLENGE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "error":"authorization_pending",
  "error_description":"Authorization pending: please repeat the request in a few seconds."
}

RESPONSE SAMPLE FOR VERIFIED CHALLENGE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}

RESPONSE SAMPLE FOR REJECTED CHALLENGE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "error":"invalid_grant",
  "error_description":"MFA Authorization rejected."
}
POST /oauth/token

Verifies multifactor authentication (MFA) using an out-of-band (OOB) challenge (either Push notification or SMS).

To verify MFA using an OOB challenge your application must make a request to /oauth/token with grant_type=http://auth0.com/oauth/grant-type/mfa-oob. Include the oob_code you received from the challenge response, as well as the mfa_token you received as part of mfa_required error.

The response to this request depends on the status of the underlying challenge verification:

  • If the challenge has been accepted and verified: it will be the same as password or http://auth0.com/oauth/grant-type/password-realm grant types.
  • If the challenge has been rejected, you will get an invalid_grant error, meaning that the challenge was rejected by the user. At this point you should stop polling, as this response is final.
  • If the challenge verification is still pending (meaning it has not been accepted nor rejected) you will get an authorization_pending error, meaning that you must retry the same request a few seconds later. If you request too frequently you will get a slow_down error.

When the challenge response includes a binding_method: prompt your app needs to prompt the user for the binding_code and send it as part of the request. The binding_code is a usually a 6 digit number (similar to an OTP) included as part of the challenge. No binding_code is necessary if the challenge response did not include a binding_method. In this scenario the response will be immediate; you will receive an invalid_grant or an access_token as response.

Request parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For OTP MFA use http://auth0.com/oauth/grant-type/mfa-oob.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
mfa_token
Required
The mfa_token you received from mfa_required error.
oob_code
Required
The oob code received from the challenge request.
binding_code A code used to bind the side channel (used to deliver the challenge) with the main channel you are using to authenticate. This is usually an OTP-like code delivered as part of the challenge message.

More informationm

Verify with recovery code

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "mfa_token": "MFA_TOKEN",
  "grant_type": "http://auth0.com/oauth/grant-type/mfa-recovery-code",
  "recovery_code": "RECOVERY_CODE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"mfa_token":"MFA_TOKEN", "recovery_code":"RECOVERY_CODE", "grant_type": "http://auth0.com/oauth/grant-type/mfa-recovery-code", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { mfa_token: 'MFA_TOKEN',
     recovery_code: 'RECOVERY_CODE',
     grant_type: 'http://auth0.com/oauth/grant-type/mfa-recover-code',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE FOR OTP:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400,
  "recovery_code": "abcdefg"
}
POST /oauth/token

Verifies multifactor authentication (MFA) using a recovery code.

Some multifactor authentication (MFA) providers (such as Guardian) support using a recovery code to login. Use this method to authenticate when the user's enrolled device is unavailable, or the user cannot receive the challenge or accept it due to connectivity issues.

To verify MFA using a recovery code your app must prompt the user for the recovery code, and then make a request to oauth/token with grant_type=http://auth0.com/oauth/grant-type/mfa-recovery-code. Include the collected recovery code and the mfa_token from the mfa_required error. If the recovery code is accepted the response will be the same as for password or http://auth0.com/oauth/grant-type/password-realm grant types. It might also include a recovery_code field, which the application must display to the end-user to be stored securely for future use.

Request parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For OTP MFA use http://auth0.com/oauth/grant-type/mfa-otp.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
mfa_token
Required
The mfa_token you received from mfa_required error.
recovery_code
Required
Recovery code provided by the end-user.

Add an authenticator

POST https://YOUR_AUTH0_DOMAIN/mfa/associate
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN or MFA_TOKEN
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "authenticator_types": ["oob"],
  "oob_channels": "sms",
  "phone_number": "+1 555 123456"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/mfa/associate' \
  --header 'authorization: Bearer ACCESS_TOKEN or MFA_TOKEN' \
  --header 'content-type: application/json' \
  --data '{"client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "authenticator_types":["oob"], "oob_channels":"sms", "phone_number": "+1 555 123456"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/mfa/associate',
  headers: {
    'authorization': 'Bearer TOKEN',
    'content-type': 'application/json'
  },
  body:
   { client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET',
     authenticator_types: ["oob"],
     oob_channels: "sms",
     phone_number: "+1 555 123456" },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE FOR OOB (SMS channel):

HTTP/1.1 200 OK
Content-Type: application/json
{
  "oob_code": "Fe26.2**da6....",
  "binding_method":"prompt",
  "authenticator_type":"oob",
  "oob_channel":"sms",
  "recovery_codes":["ABCDEFGDRFK75ABYR7PH8TJA"],
}

RESPONSE SAMPLE FOR OOB (Auth0 channel):

HTTP/1.1 200 OK
Content-Type: application/json
{
  "oob_code": "Fe26.2**da6....",
  "barcode_uri":"otpauth://...",
  "authenticator_type":"oob",
  "oob_channel":"auth0",
  "recovery_codes":["ABCDEFGDRFK75ABYR7PH8TJA"],
}

RESPONSE SAMPLE FOR OTP:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "secret": "ABCDEFGMK5CE6WTZKRTTQRKUJVFXOVRF",
  "barcode_uri":"otpauth://...",
  "authenticator_type":"otp",
  "recovery_codes":["ABCDEFGDRFK75ABYR7PH8TJA"],
}
POST /mfa/associate

This endpoint is still under development. It is available to customers with early access.

Associates or adds a new authenticator for multifactor authentication.

If the user has active authenticators, an Access Token with the enroll scope and the audience set to https://YOUR_AUTH0_DOMAIN/mfa/ is required to use this endpoint.

If the user has no active authenticators, you can use the mfa_token from the mfa_required error in place of an Access Token for this request.

After an authenticator is added it must be verified. To verify the authenticator, use the response values from the /mfa/associate request in place of the values returned from the /mfa/challenge endpoint and continue with the verification flow.

A recovery_codes field is included in the response the first time an authenticator is added. You can use recovery_codes to pass multifactor authentication as shown on Verify with recovery code above.

To access this endoint you must set an Access Token at the Authorization header, with the following claims:

  • scope: enroll
  • audience: https://YOUR_AUTH0_DOMAIN/mfa/

Request parameters

Parameter Description
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field in your Client Settings is Post or Basic.
authenticator_types
Required
The type of authenticators supported by the client. Value is an array with values "otp" or "oob".
oob_channel The type of OOB channels supported by the client. An array with values "auth0" or "sms". Required if authenticator_types include oob.
phone_number The phone number to use for SMS. Required if oob_channel includes sms.

More information

List authenticators

GET https://YOUR_AUTH0_DOMAIN/mfa/authenticators
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/mfa/authenticators' \
  --header 'authorization: Bearer ACCESS_TOKEN' \
  --header 'content-type: application/json'
var request = require("request");

var options = { method: 'GET',
  url: 'https://YOUR_AUTH0_DOMAIN/mfa/authenticators',
  headers: {
    'authorization': 'Bearer ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
[
  {
    "id":"recovery-code|dev_DsvzGfZw2Fg5N3rI",
    "authenticator_type":"recovery-code",
    "active":true
  },
  {
    "id":"sms|dev_gB342kcL2K22S4yB",
    "authenticator_type":"oob",
    "oob_channel":"sms",
    "name":"+X XXXX1234",
    "active":true
  },
  {
    "id":"sms|dev_gB342kcL2K22S4yB",
    "authenticator_type":"oob",
    "oob_channel":"sms",
    "name":"+X XXXX1234",
    "active":false
  },
  {
    "id":"push|dev_433sJ7Mcwj9P794y",
    "authenticator_type":"oob",
    "oob_channel":"auth0",
    "name":"John's Device",
    "active":true
  },
    {
    "id":"totp|dev_LJaKaN5O3tjRFOw2",
    "authenticator_type":"otp",
    "active":true
  }
]
GET /mfa/authenticators

This endpoint is still under development. It is available to customers with early access.

Returns a list of authenticators associated with your application.

To access this endoint you must set an Access Token at the Authorization header, with the following claims:

  • scope: read:authenticators
  • audience: https://YOUR_AUTH0_DOMAIN/mfa/

Request Parameters

Parameter Description
ACCESS_TOKEN
Required
The access_token obtained during login.

More information

Delete an authenticator

DELETE https://YOUR_AUTH0_DOMAIN/mfa/authenticators/AUTHENTICATOR_ID
Authorization: Bearer ACCESS_TOKEN
curl --request DELETE \
  --url 'https://YOUR_AUTH0_DOMAIN/mfa/authenticators/AUTHENTICATOR_ID' \
  --header 'authorization: Bearer ACCESS_TOKEN' \
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://YOUR_AUTH0_DOMAIN/mfa/authenticators/AUTHENTICATOR_ID',
  headers: {
    'authorization': 'Bearer ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 204 OK
DELETE /mfa/authenticators

This endpoint is still under development. It is available to customers with early access.

Deletes an associated authenticator using its ID.

You can get authenticator IDs by listing the authenticators.

To access this endoint you must set an Access Token at the Authorization header, with the following claims:

  • scope: remove:authenticators
  • audience: https://YOUR_AUTH0_DOMAIN/mfa/

Request Parameters

Parameter Description
ACCESS_TOKEN
Required
The access_token obtained during login.
AUTHENTICATOR_ID
Required
The ID of the authenticator to delete.

More information

SAML

The SAML protocol is used for 3rd party SaaS applications mostly, like Salesforce and Box. Auth0 supports SP and IDP Initiated Sign On. For more information refer to: SAML.

Accept Request

GET https://YOUR_AUTH0_DOMAIN/samlp/YOUR_CLIENT_ID?
  connection=CONNECTION
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/samlp/YOUR_CLIENT_ID' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '"connection"="CONNECTION"'

GET /samlp/YOUR_CLIENT_ID

Use this endpoint to accept a SAML request to initiate a login.

Optionally, it accepts a connection parameter to login with a specific provider. If no connection is specified, the Auth0 Login Page will be shown.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application.
connection The connection to use.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • All the parameters of the SAML response can be modified with Rules.
  • The SAML request AssertionConsumerServiceURL will be used to POST back the assertion. It must match the application's callback_URL.

More Information

Get Metadata

GET https://YOUR_AUTH0_DOMAIN/samlp/metadata/YOUR_CLIENT_ID
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/samlp/metadata/YOUR_CLIENT_ID'

GET /samlp/metadata/YOUR_CLIENT_ID

This endpoint returns the SAML 2.0 metadata.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

More Information

IdP-Initiated SSO Flow

POST https://YOUR_AUTH0_DOMAIN/login/callback?connection=CONNECTION
Content-Type: 'application/x-www-form-urlencoded'
  SAMLResponse=SAML_RESPONSE
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/login/callback' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '"connection":"CONNECTION", "SAMLResponse":"SAML_RESPONSE"'

POST /login/callback

This endpoint accepts an IdP-Initiated Sign On SAMLResponse from a SAML Identity Provider. The connection corresponding to the identity provider is specified in the querystring. The user will be redirected to the application that is specified in the SAML Provider IdP-Initiated Sign On section.

Request Parameters

Parameter Description
connection
Required
The name of an identity provider configured to your application.
SAMLResponse
Required
An IdP-Initiated Sign On SAML Response.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the field Application (select the application you want to use for the test) and Connection (the name of the configured identity provider).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the Other Flows tab, click SAML.

More Information

WS-Federation

Accept Request

GET https://YOUR_AUTH0_DOMAIN/wsfed/YOUR_CLIENT_ID
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/wsfed/YOUR_CLIENT_ID'

GET /wsfed/YOUR_CLIENT_ID

This endpoint accepts a WS-Federation request to initiate a login.

Request Parameters

Parameter Description
client-id The client-id of your application.
wtrealm Can be used in place of client-id.
whr The name of the connection (used to skip the login page).
wctx Your application's state.
wreply The callback URL.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the field Application (select the application you want to use for the test) and Connection (the name of the configured identity provider).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the Other Flows tab, click WS-Federation.

Remarks

  • The wtrealm parameter must be in one of these formats:
    • urn:clientID (for example, urn:YOUR_CLIENT_ID)
    • If this parameter does not begin with a urn, the client.clientAliases array is used for look-up. This can only be set with the /api/v2/clients Management API.
  • The whr parameter is mapped to the connection like this: urn:CONNECTION_NAME. For example, urn:google-oauth2 indicates login with Google. If there is no whr parameter included, the user will be directed to the Auth0 Login Page.

More Information

Get Metadata

GET https://YOUR_AUTH0_DOMAIN/wsfed/YOUR_CLIENT_ID/FederationMetadata/2007-06/FederationMetadata.xml
curl --request GET \
  --url 'https://YOUR_AUTH0_DOMAIN/wsfed/YOUR_CLIENT_ID/FederationMetadata/2007-06/FederationMetadata.xml'

GET /wsfed/YOUR_CLIENT_ID/FederationMetadata/2007-06/FederationMetadata.xml

This endpoint returns the WS-Federation metadata.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

More Information

Impersonation

POST https://YOUR_AUTH0_DOMAIN/users/{user_id}/impersonate
Content-Type:   application/json
Authorization:  'Bearer {ACCESS_TOKEN}'
{
  protocol: "PROTOCOL",
  impersonator_id: "IMPERSONATOR_ID",
  client_id: "YOUR_CLIENT_ID",
  additionalParameters: [
    "response_type": "code",
    "state": "STATE"
  ]
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/users/{user_id}/impersonate' \
  --header 'Authorization: Bearer {ACCESS_TOKEN}' \
  --header 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
  --data '{"protocol":"PROTOCOL", "impersonator_id":"IMPERSONATOR_ID", "client_id":"YOUR_CLIENT_ID", "additionalParameters": {"response_type": "code", "state": "STATE"}}'
var url = 'https://' + YOUR_AUTH0_DOMAIN + '/users/' + localStorage.getItem('user_id') + '/impersonate';
var params = 'protocol=PROTOCOL&impersonator_id=IMPERSONATOR_ID&client_id=YOUR_CLIENT_ID';

var xhr = new XMLHttpRequest();

xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem('access_token'));

xhr.onload = function() {
  if (xhr.status == 200) {
    fetchProfile();
  } else {
    alert("Request failed: " + xhr.statusText);
  }
};

xhr.send(params);

RESPONSE SAMPLE:

https:/YOUR_DOMAIN/users/IMPERSONATOR_ID/impersonate?&bewit=WFh0MUtm...

POST /users/{user_id}/impersonate

Impersonation has been deprecated and will not be enabled for customers any longer. The functionality will continue to work for the customers that have it already enabled. If this changes customers will be notified beforehand and given ample time to migrate.

Use this endpoint to obtain an impersonation URL to login as another user. Useful for troubleshooting.

Request Parameters

Parameter Description
protocol
Required
The protocol to use against the identity provider: oauth2, samlp, wsfed, wsfed-rms.
impersonator_id
Required
The user_id of the impersonator.
client_id
Required
The client_id of the client that is generating the impersonation link.
additionalParameters This is a JSON object. You can use this to set additional parameters, like response_type, scope and state.

Remarks

  • This endpoint can only be used with Global Client credentials.

  • To distinguish between real logins and impersonation logins, the profile of the impersonated user will contain additional impersonated and impersonator properties. For example: "impersonated": true, "impersonator": {"user_id": "auth0|...", "email": "admin@example.com"}.

  • For a regular web app, you should set the additionalParameters: set the response_type to be code, the callback_url to be the callback url to which Auth0 will redirect with the authorization code, and the scope to be the JWT claims that you want included in the JWT.

More Information

Dynamic Application (Client) Registration

POST https://YOUR_AUTH0_DOMAIN/oidc/register
Content-Type: application/json
{
  "client_name": "YOUR-NEW-CLIENT-NAME",
  "redirect_uris": [],
  "token_endpoint_auth_method": "client_secret_post"
}
curl --request POST \
  --url https://YOUR_AUTH0_DOMAIN/oidc/register \
  --header 'content-type: application/json' \
  --data '{"client_name": "YOUR-NEW-CLIENT-NAME","redirect_uris": [], "token_endpoint_auth_method": "client_secret_post"}'

RESPONSE SAMPLE:

{
  "client_name": "My Dynamic Client",
  "client_id": "8SXWY6j3afl2CP5ntwEOpMdPxxy49Gt2",
  "client_secret": "Q5O...33P",
  "redirect_uris": [
    "https://client.example.com/callback",
    "https://client.example.com/callback2"
  ],
  "client_secret_expires_at": 0
}
POST /oidc/register

With a name and the necessary callback URLs, you can dynamically register a client with Auth0. No token is needed for this request.

Request Parameters

Parameter Description
client_name The name of the Dynamic Client to be created. It is recommended to provide a value but if it is omitted, the default name "My App" will be used.
redirect_uris
Required
An array of URLs that Auth0 will deem valid to call at the end of an Authentication flow.
token_endpoint_auth_method Default value is client_secret_post, but it can also be none.

API Authorization

Authorize Application

To begin an OAuth 2.0 Authorization flow, your application should first send the user to the authorization URL.

The purpose of this call is to obtain consent from the user to invoke the API (specified in audience) and do certain things (specified in scope) on behalf of the user. Auth0 will authenticate the user and obtain consent, unless consent has been previously given. If you alter the value in scope, Auth0 will require consent to be given again.

The OAuth 2.0 flows that require user authorization are:

On the other hand, the Resource Owner Password Grant and Client Credentials flows do not use this endpoint since there is no user authorization involved. Instead they invoke directly the POST /oauth/token endpoint to retrieve an Access Token.

Based on the OAuth 2.0 flow you are implementing, the parameters slightly change. To determine which flow is best suited for your case refer to: Which OAuth 2.0 flow should I use?.

Authorization Code Grant

GET https://YOUR_AUTH0_DOMAIN/authorize?
  audience=API_IDENTIFIER&
  scope=SCOPE&
  response_type=code&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=https://YOUR_APP/callback&
  state=STATE

RESPONSE SAMPLE

HTTP/1.1 302 Found
Location: https://YOUR_APP/callback?code=AUTHORIZATION_CODE&state=STATE
GET /authorize

This is the OAuth 2.0 grant that regular web apps utilize in order to access an API.

Request Parameters

Parameter Description
audience
The unique identifier of the target API you want to access.
scope The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as profile and email, custom claims that must conform to a namespaced format, or any scopes supported by the target API (for example, read:contacts). Include offline_access to get a Refresh Token.
response_type
Required
Indicates to Auth0 which OAuth 2.0 flow you want to perform. Use code for Authorization Code Grant Flow.
client_id
Required
Your application's ID.
state
Recommended
An opaque value the application adds to the initial request that Auth0 includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks.
redirect_uri The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
prompt To initiate a silent authentication request, use prompt=none (see Remarks for more info).

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Client field to the application you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set the fields Audience (to the unique identifier of the API you want to access), Response Type (set to code) and enable the Audience switch.

  4. Click OAuth / OIDC Login. Following the redirect, the URL will contain the authorization code. Note, that the code will be set at the Authorization Code field so you can proceed with exchanging it for an Access Token.

Remarks

  • In order to improve compatibility for applications, Auth0 will now return profile information in a structured claim format as defined by the OIDC specification. This means that in order to add custom claims to ID Tokens or Access Tokens, they must conform to a namespaced format to avoid possible collisions with standard OIDC claims. For example, if you choose the namespace https://foo.com/ and you want to add a custom claim named myclaim, you would name the claim https://foo.com/myclaim, instead of myclaim.
  • Include offline_access to the scope request parameter to get a Refresh Token from POST /oauth/token. Make sure that the Allow Offline Access field is enabled in the API Settings.
  • The redirect_uri value must be specified as a valid callback URL under your Application's Settings.
  • Silent authentication lets you perform an authentication flow where Auth0 will only reply with redirects, and never with a login page. When an Access Token has expired, silent authentication can be used to retrieve a new one without user interaction, assuming the user's SSO session has not expired.

More Information

Authorization Code Grant (PKCE)

GET https://YOUR_AUTH0_DOMAIN/authorize?
  audience=API_IDENTIFIER&
  scope=SCOPE&
  response_type=code&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=https://YOUR_APP/callback&
  code_challenge=CODE_CHALLENGE&
  code_challenge_method=S256

RESPONSE SAMPLE

HTTP/1.1 302 Found
Location: https://YOUR_APP/callback?code=AUTHORIZATION_CODE
GET /authorize

This is the OAuth 2.0 grant that mobile apps utilize in order to access an API. Before starting with this flow, you need to generate and store a code_verifier, and using that, generate a code_challenge that will be sent in the authorization request.

Request Parameters

Parameter Description
audience
The unique identifier of the target API you want to access.
scope The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as profile and email, custom claims that must conform to a namespaced format, or any scopes supported by the target API (for example, read:contacts). Include offline_access to get a Refresh Token.
response_type
Required
Indicates to Auth0 which OAuth 2.0 Flow you want to perform. Use code for Authorization Code Grant (PKCE) Flow.
client_id
Required
Your application's Client ID.
state
Recommended
An opaque value the clients adds to the initial request that Auth0 includes when redirecting the back to the client. This value must be used by the client to prevent CSRF attacks.
redirect_uri The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
code_challenge_method
Required
Method used to generate the challenge. The PKCE spec defines two methods, S256 and plain, however, Auth0 supports only S256 since the latter is discouraged.
code_challenge
Required
Generated challenge from the code_verifier.
prompt To initiate a silent authentication request, use prompt=none (see Remarks for more info).

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Application field to the app you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set the fields Audience (to the unique identifier of the API you want to access), Response Type (set to code) and enable the Audience and PKCE switches.

  4. Click OAuth / OIDC Login. Following the redirect, the URL will contain the authorization code. Note, that the code will be set at the Authorization Code field, and the Code Verifier will be automatically set as well, so you can proceed with exchanging the code for an Access Token.

Remarks

  • In order to improve compatibility for applications, Auth0 will now return profile information in a structured claim format as defined by the OIDC specification. This means that in order to add custom claims to ID Tokens or Access Tokens, they must conform to a namespaced format to avoid possible collisions with standard OIDC claims. For example, if you choose the namespace https://foo.com/ and you want to add a custom claim named myclaim, you would name the claim https://foo.com/myclaim, instead of myclaim.
  • Include offline_access to the scope request parameter to get a Refresh Token from POST /oauth/token. Make sure that the Allow Offline Access field is enabled in the API Settings.
  • The redirect_uri value must be specified as a valid callback URL under your Client's Settings.
  • Silent authentication lets you perform an authentication flow where Auth0 will only reply with redirects, and never with a login page. When an Access Token has expired, silent authentication can be used to retrieve a new one without user interaction, assuming the user's SSO session has not expired.

More Information

Implicit Grant

GET https://YOUR_AUTH0_DOMAIN/authorize?
  audience=API_IDENTIFIER&
  scope=SCOPE&
  response_type=token|id_token|id_token token&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=https://YOUR_APP/callback&
  state=STATE&
  nonce=NONCE

RESPONSE SAMPLE

HTTP/1.1 302 Found
Location: https://YOUR_APP/callback#access_token=TOKEN&state=STATE&token_type=TYPE&expires_in=SECONDS
GET /authorize

This is the OAuth 2.0 grant that web apps utilize in order to access an API.

Request Parameters

Parameter Description
audience
The unique identifier of the target API you want to access.
scope The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as profile and email, custom claims that must conform to a namespaced format, or any scopes supported by the target API (for example, read:contacts).
response_type
Required
This will specify the type of token you will receive at the end of the flow. Use token to get only an access_token, id_token to get only an id_token (if you don't plan on accessing an API), or id_token token to get both an id_token and an access_token.
client_id
Required
Your application's ID.
state
Recommended
An opaque value the application adds to the initial request that Auth0 includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks.
redirect_uri The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
nonce
Recommended
A string value which will be included in the ID Token response from Auth0, used to prevent token replay attacks. It is required for response_type=id_token token.
connection The name of the connection configured to your application.
prompt To initiate a silent authentication request, use prompt=none (see Remarks for more info).

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Application field to the app you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your application Settings.

  3. At the OAuth2 / OIDC tab, set the fields Audience (to the unique identifier of the API you want to access), Response Type (set to token) and enable the Audience switch.

  4. Click OAuth / OIDC Login.

Remarks

  • The redirect_uri value must be specified as a valid callback URL under your Application's Settings.
  • If response_type=token, after the user authenticates with the provider, this will redirect them to your application callback URL while passing the access_token in the address location.hash. This is used for Single Page Apps and on Native Mobile SDKs.
  • The Implicit Grant does not support the issuance of Refresh Tokens. You can use Silent Authentication instead.
  • In order to improve compatibility for applications, Auth0 will now return profile information in a structured claim format as defined by the OIDC specification. This means that in order to add custom claims to ID Tokens or Access Tokens, they must conform to a namespaced format to avoid possible collisions with standard OIDC claims. For example, if you choose the namespace https://foo.com/ and you want to add a custom claim named myclaim, you would name the claim https://foo.com/myclaim, instead of myclaim.
  • Silent authentication lets you perform an authentication flow where Auth0 will only reply with redirects, and never with a login page. When an Access Token has expired, silent authentication can be used to retrieve a new one without user interaction, assuming the user's SSO session has not expired.

More Information

Get Token

Use this endpoint to:

  • Get an access_token in order to call an API. You can, optionally, retrieve an id_token and a refresh_token as well.
  • Refresh your Access Token, using a Refresh Token you got during authorization.

Note that the only OAuth 2.0 flows that can retrieve a Refresh Token are:

Authorization Code

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "grant_type": "authorization_code",
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "code": "AUTHORIZATION_CODE",
  "redirect_uri": "https://YOUR_APP/callback"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type":"authorization_code","client_id": "YOUR_CLIENT_ID","client_secret": "YOUR_CLIENT_SECRET","code": "AUTHORIZATION_CODE","redirect_uri": "https://YOUR_APP/callback"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { grant_type: 'authorization_code',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET',
     code: 'AUTHORIZATION_CODE',
     redirect_uri: 'https://YOUR_APP/callback' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "refresh_token":"GEbRxBN...edjnXbL",
  "id_token":"eyJ0XAi...4faeEoQ",
  "token_type":"Bearer",
  "expires_in":86400
}
POST /oauth/token

This is the OAuth 2.0 grant that regular web apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token.

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For Authorization Code use authorization_code.
client_id
Required
Your application's Client ID.
client_secret
Required
Your application's Client Secret.
code
Required
The Authorization Code received from the initial /authorize call.
redirect_uri This is required only if it was set at the GET /authorize endpoint. The values must match.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

If you have just executed the Authorization Code Grant you should already have a code set at the Authorization Code field of the OAuth2 / OIDC tab. If so, click OAuth2 Code Exchange, otherwise follow the instructions.

  1. At the Configuration tab, set the Application field to the application you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Client Settings.

  3. At the OAuth2 / OIDC tab, set the field Authorization Code to the code you retrieved from Authorization Code Grant. Click OAuth2 Code Exchange.

More Information

Authorization Code (PKCE)

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "grant_type": "authorization_code",
  "client_id": "YOUR_CLIENT_ID",
  "code_verifier": "CODE_VERIFIER",
  "code": "AUTHORIZATION_CODE",
  "redirect_uri": "com.myclientapp://myclientapp.com/callback"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type":"authorization_code","client_id": "YOUR_CLIENT_ID","code_verifier": "CODE_VERIFIER","code": "AUTHORIZATION_CODE","redirect_uri": "com.myclientapp://myclientapp.com/callback"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body: '{"grant_type":"authorization_code","client_id": "YOUR_CLIENT_ID","code_verifier": "CODE_VERIFIER","code": "AUTHORIZATION_CODE","redirect_uri": "com.myclientapp://myclientapp.com/callback", }' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "refresh_token":"GEbRxBN...edjnXbL",
  "id_token":"eyJ0XAi...4faeEoQ",
  "token_type":"Bearer",
  "expires_in":86400
}
POST /oauth/token

This is the OAuth 2.0 grant that mobile apps utilize in order to access an API. Use this endpoint to exchange an Authorization Code for a Token.

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For Authorization Code (PKCE) use authorization_code.
client_id
Required
Your application's Client ID.
code
Required
The Authorization Code received from the initial /authorize call.
code_verifier
Required
Cryptographically random key that was used to generate the code_challenge passed to /authorize.
redirect_uri This is required only if it was set at the GET /authorize endpoint. The values must match.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

If you have just executed the Authorization Code Grant (PKCE) you should already have the Authorization Code and Code Verifier fields, of the OAuth2 / OIDC tab, set. If so, click OAuth2 Code Exchange, otherwise follow the instructions.

  1. At the Configuration tab, set the Client field to the application you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Client Settings.

  3. At the OAuth2 / OIDC tab, set the field Authorization Code to the code you retrieved from Authorization Code Grant, and the Code Verifier to the key. Click OAuth2 Code Exchange.

More Information

Client Credentials

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "audience": "API_IDENTIFIER",
  "grant_type": "client_credentials",
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"audience":"API_IDENTIFIER", "grant_type":"client_credentials", "client_id":"YOUR_CLIENT_ID", "client_secret":"YOUR_CLIENT_SECRET"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET',
     audience: 'API_IDENTIFIER',
     grant_type: 'client_credentials' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}
POST /oauth/token

This is the OAuth 2.0 grant that server processes utilize in order to access an API. Use this endpoint to directly request an access_token by using the Client Credentials (a Client ID and a Client Secret).

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For Client Credentials use client_credentials.
client_id
Required
Your application's Client ID.
client_secret
Required
Your application's Client Secret.
audience
Required
The unique identifier of the target API you want to access.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Client field to the application you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Client Settings.

  3. At the OAuth2 / OIDC tab, click OAuth2 Client Credentials.

More Information

Resource Owner Password

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "grant_type": "password",
  "username": "USERNAME",
  "password": "PASSWORD",
  "audience": "API_IDENTIFIER",
  "scope": "SCOPE",
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type":"password", "username":"USERNAME", "password":"PASSWORD", "audience":"API_IDENTIFIER", "scope":"SCOPE", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"
 }'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { grant_type: 'password',
     username: 'USERNAME',
     password: 'PASSWORD',
     audience: 'API_IDENTIFIER',
     scope: 'SCOPE',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}
POST /oauth/token

This flow should only be used from highly trusted applications that cannot do redirects. If you can use redirect-based flows from your apps we recommend using the Authorization Code Grant instead.

This is the OAuth 2.0 grant that highly trusted apps use in order to access an API. In this flow the end-user is asked to fill in credentials (username/password) typically using an interactive form in the user-agent (browser). This information is sent to the backend and from there to Auth0. It is therefore imperative that the application is absolutely trusted with this information. For client side applications and mobile apps we recommend using web flows instead.

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. For Resource Owner Password use password. To add realm support use http://auth0.com/oauth/grant-type/password-realm.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
audience The unique identifier of the target API you want to access.
username
Required
Resource Owner's identifier.
password
Required
Resource Owner's secret.
scope String value of the different scopes the application is asking for. Multiple scopes are separated with whitespace.
realm String value of the realm the user belongs. Set this if you want to add realm support at this grant. For more information on what realms are refer to Realm Support.

Request headers

Parameter Description
auth0-forwarded-for End-user IP as a string value. Set this if you want brute-force protection to work in server-side scenarios. For more information on how and when to use this header, refer to Using resource owner password from server-side.

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Client field to the application you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Client Settings.

  3. At the OAuth2 / OIDC tab, set the Username and Password, and click Password Grant.

Remarks

  • The scopes issued to the application may differ from the scopes requested. In this case, a scope parameter will be included in the response JSON.
  • If you don't request specific scopes, all scopes defined for the audience will be returned due to the implied trust to the application in this grant. You can customize the scopes returned in a rule. For more information, refer to Calling APIs from Highly Trusted Applications.
  • To add realm support set the grant_type to http://auth0.com/oauth/grant-type/password-realm, and the realm to the realm the user belongs. This maps to a connection in Auth0. For example, if you have configured a database connection for your internal employees and you have named the connection employees, then use this value. For more information on how to implement this refer to: Realm Support.
  • In addition to username and password, Auth0 may also require the end-user to provide an additional factor as proof of identity before issuing the requested scopes. In this case, the request described above will return an mfa_required error along with an mfa_token. You can use these tokens to request a challenge for the possession factor and validate it accordingly. For details refer to Resource Owner Password and MFA.

More Information

Refresh Token

POST https://YOUR_AUTH0_DOMAIN/oauth/token
Content-Type: application/json
{
  "grant_type": "refresh_token",
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "refresh_token": "YOUR_REFRESH_TOKEN"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
  --header 'content-type: application/json' \
  --data '{"grant_type":"refresh_token","client_id": "YOUR_CLIENT_ID","client_secret": "YOUR_CLIENT_SECRET","refresh_token": "YOUR_REFRESH_TOKEN"}'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/token',
  headers: { 'content-type': 'application/json' },
  body:
   { grant_type: 'refresh_token',
     client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET',
     refresh_token: 'YOUR_REFRESH_TOKEN'},
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token": "eyJ...MoQ",
  "expires_in": 86400,
  "scope": "openid offline_access",
  "id_token": "eyJ...0NE",
  "token_type": "Bearer"
}
POST /oauth/token

Use this endpoint to refresh an Access Token using the Refresh Token you got during authorization.

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. To refresh a token, use refresh_token.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Client Settings is Post or Basic.
refresh_token
Required
The Refresh Token to use.

Test this endpoint

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Client field to the client you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Client Settings.

  3. At the OAuth2 / OIDC tab, set the field Refresh Token to the Refresh Token you have. Click OAuth2 Refresh Token Exchange.

More Information

Revoke Refresh Token

POST https://YOUR_AUTH0_DOMAIN/oauth/revoke
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "token": "YOUR_REFRESH_TOKEN",
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/revoke' \
  --header 'content-type: application/json' \
  --data '{ "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "token": "YOUR_REFRESH_TOKEN" }'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/revoke',
  headers: { 'content-type': 'application/json' },
  body: 
   { client_id: 'YOUR_CLIENT_ID',
     client_secret: 'YOUR_CLIENT_SECRET',
     token: 'YOUR_REFRESH_TOKEN' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
(empty-response-body)
POST /oauth/revoke

Use this endpoint to invalidate a Refresh Token if it has been compromised.

Each revocation request invalidates not only the specific token, but all other tokens based on the same authorization grant. This means that all Refresh Tokens that have been issued for the same user, application, and audience will be revoked.

Request Parameters

Parameter Description
client_id
Required
Your application's Client ID. The application should match the one the Refresh Token was issued for.
client_secret Your application's Client Secret. Required for confidential applications.
token
Required
The Refresh Token you want to revoke.

Remarks

  • For non-confidential applications that cannot keep the Client Secret safe (for example, native apps), the endpoint supports passing no Client Secret but the application itself must have the property tokenEndpointAuthMethod set to none. You can do this either from the UI (Dashboard > Applications > Application Settings) or using the Management API.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /oauth/revoke.

More Information

Legacy

Login

Social with Provider's Access Token

POST https://YOUR_AUTH0_DOMAIN/oauth/access_token
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "access_token": "ACCESS_TOKEN",
  "connection": "CONNECTION",
  "scope": "SCOPE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/access_token' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "access_token":"ACCESS_TOKEN", "connection":"CONNECTION", "scope":"SCOPE"}'
var url = 'https://' + YOUR_AUTH0_DOMAIN + '/oauth/access_token';
var params = 'client_id=YOUR_CLIENT_ID&access_token={ACCESS_TOKEN}&connection={CONNECTION}&scope={SCOPE}';

var xhr = new XMLHttpRequest();

xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json');

xhr.onload = function() {
  if (xhr.status == 200) {
    fetchProfile();
  } else {
    alert("Request failed: " + xhr.statusText);
  }
};

xhr.send(params);

RESPONSE SAMPLE:

{
  "id_token": "eyJ0eXAiOiJKV1Qi...",
  "access_token": "A9CvPwFojaBI...",
  "token_type": "bearer"
}
POST /oauth/access_token

This endpoint is part of the legacy authentication pipeline. We recommend that you open the browser to do social authentication instead, which is what Google and Facebook are recommending. For more information on the latest authentication pipeline refer to Introducing OIDC Conformant Authentication.

This feature is disabled by default for new tenants as of 8 June 2017. Please see Application Grant Types for more information.

Given the social provider's access_token and the connection, this endpoint will authenticate the user with the provider and return a JSON with the access_token and, optionally, an id_token. This endpoint only works for Facebook, Google, Twitter and Weibo.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application.
access_token
Required
The social provider's access_token.
connection
Required
The name of an identity provider configured to your app.
scope Use openid to get an id_token, or openid profile email to include user information in the id_token. If null, only an access_token will be returned.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • The profile scope value requests access to the End-User's default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.

  • The email scope value requests access to the email and email_verified Claims.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /oauth/access_token.

More Information

Database/AD/LDAP (Active)

POST https://YOUR_AUTH0_DOMAIN/oauth/ro
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "username": "USERNAME",
  "password": "PASSWORD",
  "connection": "CONNECTION",
  "scope": "openid"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/ro' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "username":"USERNAME", "password":"PASSWORD", "connection":"CONNECTION", "scope":"openid"}'

// Script uses auth0.js. See Remarks for details.
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  // Initialize application
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });

  // Trigger login using redirect with credentials to enterprise connections
  webAuth.redirect.loginWithCredentials({
    connection: 'Username-Password-Authentication',
    username: 'testuser',
    password: 'testpass',
    scope: 'openid'
  });

  // Trigger login using popup mode with credentials to enterprise connections
  webAuth.popup.loginWithCredentials({
    connection: 'Username-Password-Authentication',
    username: 'testuser',
    password: 'testpass',
    scope: 'openid'
  });

  // The client.login method allows for non redirect auth using custom database connections, using /oauth/token.
  webAuth.client.login({
    realm: 'tests',
    username: 'testuser',
    password: 'testpass',
    scope: 'openid profile',
    audience: 'urn:test'
  });
</script>
POST /oauth/ro

This endpoint is part of the legacy authentication pipeline and has been replaced in favor of the Password Grant. For more information on the latest authentication pipeline refer to Introducing OIDC Conformant Authentication.

Use this endpoint for API-based (active) authentication. Given the user credentials and the connection specified, it will do the authentication on the provider and return a JSON with the access_token and id_token.

Request Parameters

Parameter Description
client_id
Required
The client_id of your application
username
Required
Username/email of the user to login
password
Required
Password of the user to login
connection
Required
The name of the connection to use for login
scope Set to openid to retrieve also an id_token, leave null to get only an access_token
grant_type
Required
Set to password to authenticate using username/password or urn:ietf:params:oauth:grant-type:jwt-bearer to authenticate using an id_token (used to Authenticate users with Touch ID)
device String value. Required when grant_type is urn:ietf:params:oauth:grant-type:jwt-bearer
id_token Used to authenticate using a token instead of username/password, in Touch ID scenarios. Required when grant_type is urn:ietf:params:oauth:grant-type:jwt-bearer

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the fields Application (select the application you want to use for the test) and Connection (the name of the social connection to use).

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set Username and Password. Click Resource Owner Endpoint.

Remarks

  • This endpoint only works for database connections, passwordless connections, Active Directory/LDAP, Windows Azure AD and ADFS.

  • The main difference between passive and active authentication is that the former happens in the browser through the Auth0 Login Page and the latter can be invoked from anywhere (a script, server to server, and so forth).

  • The sample auth0.js script uses the library version 8. If you are using auth0.js version 7, please see this reference guide.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /oauth/ro.

More Information

User Profile

Get Token Info

POST https://YOUR_AUTH0_DOMAIN/tokeninfo
Content-Type: application/json
{
  "id_token": "ID_TOKEN"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/tokeninfo' \
  --header 'content-type: application/json' \
  --data '{"id_token":""}'
<script src="https://cdn.auth0.com/js/auth0/9.5.1/auth0.min.js"></script>
<script type="text/javascript">
  var webAuth = new auth0.WebAuth({
    domain:       'YOUR_AUTH0_DOMAIN',
    clientID:     'YOUR_CLIENT_ID'
  });
</script>

webAuth.parseHash(window.location.hash, function(err, authResult) {
  if (err) {
    return console.log(err);
  }

  webAuth.client.userInfo(authResult.accessToken, function(err, user) {
    // Now you have the user's information
  });
});

RESPONSE SAMPLE:

{
  "email_verified": false,
  "email": "foo@bar.com",
  "clientID": "q2hnj2iug0...",
  "updated_at": "2016-12-08T14:26:59.923Z",
  "name": "foo@bar.com",
  "picture": "https://s.gravatar.com/avatar/foobar.png",
  "user_id": "auth0|58454...",
  "nickname": "foo.bar",
  "identities": [
    {
      "user_id": "58454...",
      "provider": "auth0",
      "connection": "Username-Password-Authentication",
      "isSocial": false
    }
  ],
  "created_at": "2016-12-05T11:16:59.640Z",
  "global_client_id": "dfas76s..."
}
POST /tokeninfo

This endpoint is part of the legacy authentication pipeline and will be disabled for those who use our latest, OIDC conformant, pipeline. We encourage using the /userinfo endpoint instead. For more information on the latest authentication pipeline refer to Introducing OIDC Conformant Authentication.

This endpoint validates a JSON Web Token (signature and expiration) and returns the user information associated with the user id sub property of the token.

Request Parameters

Parameter Description
id_token
Required
The id_token to use.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Remarks

  • This endpoint will return three HTTP Response Headers, that provide relevant data on its rate limits:
    • X-RateLimit-Limit: Number of requests allowed per minute.
    • X-RateLimit-Remaining: Number of requests available. Each new request reduces this number by 1. For each minute that passes, requests are added back, so this number increases by 1 each time.
    • X-RateLimit-Reset: Remaining time until the rate limit (X-RateLimit-Limit) resets. The value is in UTC epoch seconds.

More Information

Account Linking

GET https://YOUR_AUTH0_DOMAIN/authorize?
  response_type=code|token&
  client_id=YOUR_CLIENT_ID&
  connection=CONNECTION&
  redirect_uri=https://YOUR_APP/callback&
  access_token=LOGGED_IN_USER_ACCESS_TOKEN
GET /authorize

This endpoint is deprecated for account linking. The POST /api/v2/users/{id}/identities should be used instead. For more information refer to the Migration Notice.

Call this endpoint when a user wants to link a second authentication method (for example, a user/password database connection, with Facebook).

This endpoint will trigger the login flow to link an existing account with a new one. This will return a 302 redirect to the connection that the current user wants to add. The user is identified by the access_token that was returned on login success.

Request Parameters

Parameter Description
response_type
Required
Use code for server side flows, token for client side flows
client_id
Required
The client_id of your application
connection The name of the connection configured to your application. If null, it will redirect to Auth0 Login Page and show the Login Widget using the first database connection.
redirect_uri
Required
The URL to which Auth0 will redirect the browser after authorization has been granted by the user.
access_token
Required
The logged-in user's Access Token

Remarks

More Information

POST https://YOUR_AUTH0_DOMAIN/login/unlink
Content-Type: application/json
{
  "access_token": "LOGGED_IN_USER_ACCESS_TOKEN", // Primary identity access_token
  "user_id": "LINKED_USER_ID" // (provider|id)
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/login/unlink' \
  --header 'content-type: application/json' \
  --data '{"access_token": "LOGGED_IN_USER_ACCESS_TOKEN", "user_id": "LINKED_USER_ID"}'
var url = 'https://' + YOUR_AUTH0_DOMAIN + '/login/unlink';
var params = 'access_token=LOGGED_IN_USER_ACCESS_TOKEN&user_id=' + localStorage.getItem('user_id');

var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json');

xhr.onload = function() {
  if (xhr.status == 200) {
    fetchProfile();
  } else {
    alert("Request failed: " + xhr.statusText);
  }
};

xhr.send(params);
POST /login/unlink

This endpoint is deprecated. The DELETE /api/v2/users/{id}/identities/{provider}/{user_id} should be used instead.

Given a logged-in user's access_token and user_id, this endpoint will unlink a user's account from the identity provider.

Request Parameters

Parameter Description
access_token
Required
The logged-in user's Access Token
user_id
Required
The logged-in user's user_id

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

More Information

Delegation

POST https://YOUR_AUTH0_DOMAIN/delegation
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
  "id_token" or "refresh_token" : "TOKEN",
  "target": "TARGET_CLIENT_ID",
  "scope": "openid",
  "api_type": "API_TYPE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/delegation' \
  --header 'content-type: application/json' \
  --data '{"client_id":"YOUR_CLIENT_ID", "grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "id_token|refresh_token":"TOKEN", "target":"TARGET_CLIENT_ID", "scope":"openid", "api_type":"API_TYPE"}'
// Delegation is not supported in version 8 of auth0.js.
// For a version 7 sample refer to: https://auth0.com/docs/libraries/auth0js/v7#delegation-token-request
POST /delegation

This feature is disabled by default for new tenants as of 8 June 2017. See the migration notice for more information.

A delegation token can be obtained and used when an application needs to call the API of an Application Addon, such as Firebase or SAP, registered and configured in Auth0, in the same tenant as the calling program.

Given an existing token, this endpoint will generate a new token signed with the target app' secret. This is used to flow the identity of the user from the application to an API.

Request Parameters

Parameter Description
client_id
Required
Τhe client_id of your app
grant_type
Required
Use urn:ietf:params:oauth:grant-type:jwt-bearer
id_token or refresh_token
Required
The existing token of the user.
target The target client_id
scope Use openid or openid profile email
api_type The API to be called.

Test with Postman

You can test this endpoint using Postman. We have a preconfigured collection that you can download and use. Simply click the button below. For more info refer to Using the Auth0 API with our Postman Collections.

Run in Postman

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Application field to the app you want to use for the test.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set the fields ID Token, Refresh Token and Target Client ID. Click Delegation.

Remarks

  • The profile scope value requests access to the End-User's default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.

  • The email scope value requests access to the email and email_verified Claims.

  • Delegation is not supported in version 8 of auth0.js. For a sample in version 7 of the library, refer to Delegation Token Request.

  • This endpoint limits up to 10 requests per minute from the same IP address with the same user_id.

  • This endpoint will return three HTTP Response Headers, that provide relevant data on its rate limits:

    • X-RateLimit-Limit: Number of requests allowed per minute.
    • X-RateLimit-Remaining: Number of requests available. Each new request reduces this number by 1. For each minute that passes, requests are added back, so this number increases by 1 each time.
    • X-RateLimit-Reset: Remaining time until the rate limit (X-RateLimit-Limit) resets. The value is in UTC epoch seconds.

More Information

Resource Owner

POST https://YOUR_AUTH0_DOMAIN/oauth/ro
Content-Type: application/json
{
  "client_id": "YOUR_CLIENT_ID",
  "connection": "CONNECTION",
  "grant_type": "password",
  "username": "USERNAME",
  "password": "PASSWORD",
  "scope": "SCOPE",
  "id_token": "ID_TOKEN",
  "device": "DEVICE"
}
curl --request POST \
  --url 'https://YOUR_AUTH0_DOMAIN/oauth/ro' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{ "client_id": "YOUR_CLIENT_ID", "connection": "CONNECTION", "grant_type": "password", "username": "USERNAME", "password": "PASSWORD", "scope": "SCOPE", "id_token": "ID_TOKEN", "device": "DEVICE" }'
var request = require("request");

var options = { method: 'POST',
  url: 'https://YOUR_AUTH0_DOMAIN/oauth/ro',
  headers: { 'content-type': 'application/json', 'accept': 'application/json' },
  body:
   { connection: 'CONNECTION',
     grant_type: 'PASSWORD',
     username: 'USERNAME',
     client_id: 'YOUR_CLIENT_ID',
     password: 'PASSWORD',
     scope: 'SCOPE',
     id_token: 'ID_TOKEN',
     device: 'DEVICE'},
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

{
  "access_token": "eyJz93a...",
  "id_token": "eyJ0XAi...",
  "token_type": "Bearer"
}
POST /oauth/ro

This endpoint is part of the legacy authentication pipeline and has been replaced in favor of the Password Grant. For more information on the latest authentication pipeline refer to Introducing OIDC Conformant Authentication.

Given the user's credentials, this endpoint will authenticate the user with the provider and return a JSON object with the access_token and an id_token.

Request Parameters

Parameter Description
client_id
Required
Your application's Application ID.
connection
Required
The name of the connection configured to your application
grant_type
Required
Use the value password
username
Required
The user's username
password
Required
The user's password
scope Use openid to get an id_token, openid profile email to get an id_token and the user profile, or openid offline_access to get an id_token and a refresh_token.
id_token Used to authenticate using a token instead of username/password, in Touch ID scenarios.
device You should set this to a string, if you are requesting a Refresh Token (scope=offline_access).

Test with Authentication API Debugger

You can use our Authentication API Debugger extension to test this endpoint. In order to do so you need to be logged in and have installed the Authentication API Debugger extension.

Click on Install Debugger to go to the article that explains how (you only have to do this once).

If you have already installed the extension, skip to the Authentication API Debugger.

The link varies according to your tenant's region: US West, Europe Central or Australia.

  1. At the Configuration tab, set the Application field to the application you want to use for the test, and Connection to the name of the connection to use.

  2. Copy the Callback URL and set it as part of the Allowed Callback URLs of your Application Settings.

  3. At the OAuth2 / OIDC tab, set the Username and Password, and click Resource Owner Endpoint.

Remarks

  • This endpoint only works for database connections, passwordless connections, Active Directory/LDAP, Windows Azure AD and ADFS.

  • The profile scope value requests access to the End-User's default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.

  • The email scope value requests access to the email and email_verified Claims.

Error Codes

For the complete error code reference for this endpoint refer to Errors > POST /oauth/ro.

More Information

Errors

Standard Error Responses

The Authentication API may return the following HTTP Status Codes:

Status Description
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method Not Allowed
429 Too Many Requests
500 Internal Server Error
503 Service Unavailable

POST /oauth/revoke

Status Description
200 {"error": "invalid_request", "error_description": "..."}
The Refresh Token is revoked, does not exist, or was not issued to the client making the revocation request.
400 {"error": "invalid_request", "error_description": "..."}
The required parameters were not sent in the request.
401 <{"error": "invalid_client", "error_description": "..."}
The request is not authorized. Check that the client credentials (client_id and client_secret) are present in the request and hold valid values.

POST /oauth/access_token

Status Response
400 {"error": "invalid_request", "error_description": "the connection was disabled"}
The connection is not active or not enabled for your client_id
400 {"error": "invalid_request", "error_description": "the connection was not found"}
400 {"error": "invalid_request", "error_description": "missing client_id parameter"}
400 {"error": "invalid_request", "error_description": "missing access_token parameter"}
401 {"error": "invalid_request", "error_description": "invalid access_token: invalid_token"}
The access_token is invalid or does not contain the scope you set
403 {"error": "unauthorized_client", "error_description": "invalid client"}

POST /oauth/ro

Grant type: jwt-bearer

Status Description
400 {"error": "invalid_request", "error_description": "missing device parameter"}
You need to provide a device name for the caller device (like a browser, app, and so on)
400 {"error": "invalid_request", "error_description": "missing id_token parameter"}
For this grant type you need to provide a JWT ID Token
400 {"error": "invalid_grant", "error_description": "..."}
Errors related to an invalid id_token or user

Grant type: password

Status Description
400 {"error": "invalid_request", "error_description": "missing username parameter"}
400 {"error": "invalid_request", "error_description": "missing password parameter"}
400 {"error": "invalid_request", "error_description": "missing connection parameter"}
400 {"error": "invalid_request", "error_description": "scope parameter must be a string"}
Incorrect scope formatting; each scope must be separated by whitespace
400 {"error": "invalid_request", "error_description": "specified strategy does not support requested operation"}
The connection/provider does not implement username/password authentication
401 {"error": "invalid_user_password", "error_description": "Wrong email or password."}
401 {"error": "unauthorized", "error_description": "user is blocked"}
401 { "error": "password_leaked", "error_description": "This login has been blocked because your password has been leaked in another website. We’ve sent you an email with instructions on how to unblock it."}
429 {"error": "too_many_attempts", "error_description": "..."}
Some anomaly detections will return this error
429 {"error": "too_many_logins", "error_description": "..."}
Some anomaly detections will return this error

All grant types

Status Description
400 {"error": "invalid_request", "error_description": "missing client_id parameter"}
400 {"error": "invalid_request", "error_description": "the connection was not found"}
400 {"error": "invalid_request", "error_description": "the connection was disabled"}
Check the connection in the dashboard, you may have turned it off for the provided client_id
400 {"error": "invalid_request", "error_description": "The connection is not yet configured..."}
The connection is not properly configured with custom scripts
400 {"error": "invalid_request", "error_description": "the connection was not found for tenant..."}
The connection does not belong to the tenant; check your base url
400 {"error": "invalid_request", "error_description": "Fields with "." are not allowed, please remove all dotted fields..."}
If you are using rules, some field name contains dots
403 {"error": "unauthorized_client", "error_description": "invalid client"}
The provided client_id is not valid
403 {"error": "access_denied", "error_description": "..."}
Validation of specific points raised an access issue

POST /passwordless/start

Status Response
400 {"error": "bad.tenant","error_description": "error in tenant - tenant validation failed: invalid_tenant"}
400 {"error": "bad.client_id", "error_description": "Missing required property: client_id"}
400 {"error": "bad.connection", "error_description": "Missing required property: connection"}
400 {"error": "bad.connection", "error_description": "Connection does not exist"}
400 {"error": "bad.connection", "error_description": "Connection is disabled"}
400 {"error": "bad.connection", "error_description": "Invalid connection strategy. It must either be a passwordless connection"}
400 {"error": "bad.authParams", "error_description": "error in authParams - invalid type: string (expected object)"}
400 {"error": "bad.request", "error_description": "the following properties are not allowed: "}
400 {"error": "bad.phone_number", "error_description": "Missing required property: phone_number"}
400 {"error": "bad.phone_number", "error_description": "String does not match pattern: ^\\+[0-9]{1,15}$"}
400 {"error": "sms_provider_error", "error_description": " (Code: )"}