Enable dynamic client registration
Auth0 supports Open Dynamic Registration, which means that if you enable this feature, anyone will be able to create applications in your tenant without a token.
enable_dynamic_client_registration
flag to true
in your tenant’s settings.
To do so, go to Dashboard > Settings > Advanced and enable the OIDC Dynamic Application Registration.
Alternatively, you can update this flag using the /Tenant/patch_settings
endpoint.
API2_ACCESS_TOKEN
with a valid token with the scope update:tenant_settings
. To learn more, read Management API Access Tokens.
Use dynamic client registration
In this section, we will see how you can dynamically register and configure an application.Register your application
To dynamically register an application with Auth0, you need to send an HTTPPOST
message to the Application Registration endpoint: https://{yourDomain}/oidc/register
. Note that Auth0 supports Open Dynamic Registration, which means that the endpoint will accept a registration request without an .
To create an application with the name My Dynamic application
and the callback URLs https://application.example.com/callback
and https://application.example.com/callback2
, use the following snippet:
- client_name: The name of the Dynamic Application to be created
- 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
, which can be none
or client_secret_post
(default value). Use token_endpoint_auth_method: none
in the request payload if creating a SPA.
The response includes the basic application information.
- client_id: Unique client identifier. This is the ID you will use while configuring your apps to use Auth0. It is generated by the system and it cannot be modified.
- client_secret: Alphanumeric 64-bit . This value is used by applications to authenticate to the Authentication API
/token
and for signing and validating . - client_secret_expires_at: Time at which the
client_secret
will expire. For Auth0 this value will always be zero (0
) which means that the application never expires.
Configure your application
Now that you have a Client ID and Secret, you can configure your application to authenticate users with Auth0. We will go through a simple example, that shows how to call an API from a client-side web app, using the Implicit Flow. First, you need to configure your application to send the user to the authorization URL:- (optional): The target API for which the Application is requesting access on behalf of the user. Set this parameter if you need API access.
- scope (optional): The scopes for which you want to request authorization. These must be separated by a space. You can request any of the standard OIDC scopes for users, such as
profile
andemail
, custom claims that must conform to a namespaced format, or any scopes supported by the target API (for example,read:contacts
). Set this parameter if you need API access. To learn more, read API Scopes. - response_type: The response type. For Implicit Grant you can either use
token
orid_token token
. This will specify the type of token you will receive at the end of the flow. Usetoken
to get only an access token, orid_token token
to get both an ID token and an access token. - client_id: Your application’s client ID.
- redirect_uri: The URL to which the (Auth0) will redirect the User Agent (Browser) after authorization has been granted by the User. The access token (and optionally an ID token) will be available in the hash fragment of this URL. This URL must be specified as a valid callback URL under the Application Settings of your application.
- state: An opaque value the applications add 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.
- : A string value that 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
.
Bearer
token in the Authorization
header of the HTTP request.