Add Permissions to Roles

Set Up an API

  1. In the Dashboard, click on the APIs menu option on the left.

    The API tab will already have one API created automatically, the Auth0 Management API. For more details on the features of the Management API and its available endpoints, refer to: Management API.

  2. Click the + Create API button.

    Create a new API

    You need to provide the following information for your API:

    • Name: a friendly name for the API. Does not affect any functionality.

    • Identifier: a unique identifier for the API. Auth0 recommends using a URL. Auth0 does differentiate between URLs that include the last forward slash. For example, and are two different identifiers. The URL does not have to be a publicly available URL. Auth0 will not call your API. This value cannot be modified afterwards.

    • Signing Algorithm: the algorithm to sign the tokens with. The available values are HS256 and RS256. When selecting RS256 the token will be signed with the tenant's private key. To learn more about signing algorithms, see Signing Algorithms.

  3. Fill in the required information and click the Create button.

    Once you do so you will be navigated to the Quick Start of your API. Here you can find details on the implementation changes you have to do to your API, which basically consists of choosing a JWT library from a predefined list and configuring this library to validate the Access Tokens in your API.

    API Quick Starts

    The other available views for your API are:

    • Settings: lists the settings for your API. Some are editable. Here you can change the token expiration time and enable offline access (this way Auth0 will allow your applications to ask for rolesRefresh Tokens for this API). For details refer to the API Settings paragraph.

    • Scopes: here you can define the scopes for this API, by setting a name and a description.

    • Machine to Machine Applications: lists all applications for which the Client Credentials grant is enabled. By default, this grant is *enabled for Regular Web Applications and Machine to Machine Applications. You can authorize any of these applications to request Access Tokens for your API. Optionally, you can select a subset of the defined scopes to limit your authorized application's access.

    • Test: from this view, you can execute a sample Client Credentials flow with any of your authorized applications to check that everything is working as expected.

API settings

Click on the Settings tab of your API to review the available settings:

  • Id: A unique alphanumeric string generated by Auth0. The information is read only and you will only need it if you will be working directly with Auth0's Management API Resource Servers endpoints.

  • Name: A friendly name for the API. Does not affect any functionality. The following characters are not allowed: < >.

  • Identifier: A unique identifier for your API. This value is set upon API creation and cannot be modified afterwards. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all.

  • Token Expiration (Seconds): The amount of time (in seconds) before the Auth0 Access Token expires. The default value is 86400 seconds (24 hours). The maximum value you can set is 2592000 seconds (30 days).

  • Allow Skipping User Consent: When a first party application requests authorized access against an API with the Allow Skipping User Consent flag set, the User Consent dialog will not be shown to the final user. Note that if the hostname of your application's Rolescallback URL is localhost or the consent dialog will always be displayed.

  • Allow Offline Access: If this setting is enabled, Auth0 will allow applications to ask for Refresh Tokens for this API.

  • Signing Algorithm: The algorithm to sign the tokens with. The available values are HS256 and RS256. When selecting RS256 (recommended) the token will be signed with the tenant's private key. This value is set upon API creation and cannot be modified afterwards. For more details on the signing algorithms see the Signing Algorithms paragraph below.

Signing algorithms

When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way.

The signature is part of a JWT. If you are not familiar with the JWT structure, please see JSON Web Tokens (JWTs) in Auth0.

To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: HS256 or RS256.

  • RS256 is an asymmetric algorithm which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature.

  • HS256 is a symmetric algorithm which means that there is only one secret key, shared between the two parties. The same key is used both to generate the signature and to validate it. Special care should be taken in order for the key to remain confidential.

The most secure practice, and our recommendation, is to use RS256. Some of the reasons are:

  • With RS256 you are sure that only the holder of the private key (Auth0) can sign tokens, while anyone can check if the token is valid using the public key.

  • Under HS256, if the secret key is compromised (e.g. by the application) you would have to re-deploy the API with the new secret.

  • With RS256 you can request a token that is valid for multiple audiences.

  • With RS256 you can implement key rotation without having to re-deploy the API with the new secret.

Verify an RS256 signed token

Go to Dashboard > Applications. Open the Settings of your applications, scroll down and open Advanced Settings. Open the Certificates tab and you will find the Public Key in the Signing Certificate field.

If you want to use the Public Key to verify a JWT signature on, you can copy the Public Key and paste it in the Public Key or Certificate field under the Verify Signature section on the website.

If you want to verify the signature of a token from one of your applications, we recommend that you get the Public Key from your tenant's JSON Web Key Set (JWKS). Your tenant's JWKS is https://YOUR_DOMAIN/.well-known/jwks.json.

For a more detailed overview of the JWT signing algorithms, see JSON Web Token (JWT) Signing Algorithms Overview.

Keep reading