To use Auth0 as an OAuth 2.0 authorization server, you'll need to execute the following setup steps:
- Create an Auth0 API and Machine to Machine Application.
- Create a Connection to store your users.
- Create a user so that you can test your integration when you've finished setting it up.
Step 1: Create an API and Machine to Machine Application
An API is an entity that represents an external resource that's capable of accepting and responding to requests made by applications. You'll need to create an Auth0 API using the Management Dashboard to represent the API managed by Azure's API Management Service that you want secured by Auth0.
You'll also need a Machine to Machine Application, which represents your application and allows use of Auth0 for authentication. When you create an API, Auth0 automatically creates an associated Machine to Machine Application by default.
To begin, you'll need to log into the Auth0 Management Dashboard. Go the APIs and click Create API.
Set the following parameters to create your new API:
|Name||A descriptive name for your API. In this example, we'll use
|Identifier||A logical and unique identifier for your API. We recommend using a URL, but it doesn't have to be a publicly-available URL since Auth0 doesn't call your API. You cannot modify this value at a later point. We'll use
|Signing Algorithm||The method used to sign the tokens issued by Auth0. Choose from
When complete, click Create.
When your API is ready, you'll be shown the Quick Start page for the API. Switch over to the Machine to Machine Applications tab. You'll see that Auth0 has also created and enabled a Machine to Machine Application for use with your API.
Step 2: Create a Connection
Go to the Management Dashboard. Navigate to Connections > Database Connections, and click Create DB Connection.
The only thing you'll need to provide at this time is a descriptive Name for your connection. We suggest choosing a name that reflects the source of users (such as
site-sign-ups for a database connection where users sign up on your site).
Click Create to proceed.
Enable the Connection for Your Application
Once Auth0 has created your Connection, you'll be redirected to your Connection's Settings page. Switch over to the Applications tab, where you'll see a full list of all the Applications you have with this account. You'll need to enable the Connection for use with the Machine to Machine Application that you're using with your API.
Step 3: Create a User
Finally, we'll create a user that we use later on to test the integration.
Go to the Users section of the Management Dashboard. Click Create User.
Provide an email and password for your new user. Be sure to indicate that this user should use BasicCalculator in the Connection field.
Connection to the connection you created earlier (which, if you're following along with our example, is
Click Save to proceed.
At this point, you've set up Auth0 for use as an OAuth 2.0 authorization server. You will now configure the Azure API Management Service and import an API for use with the service.