Client Credentials Flow for Service Apps

This exercise will walk you through the process of using the OAuth Client Credentials grant to get an access token.

The goal of this exercise is to get an access token using the client credentials grant. This exercise will walk you through the flow manually without writing any code. You are of course free to write code to do this instead if you’d like, but the instructions here will show you the step by step process of what’s happening under the hood.

From the side menu of your Auth0 dashboard, click on Applications and choose Applications.

Click Create Application, then choose Machine to Machine Applications as the application type.

Next you’ll need to select the API you want to allow this application to be able to access.

Choose the API you created in the Getting Started exercise.

Click Authorize to finish creating the machine-to-machine application, then click the Settings tab to see the client ID and secret. You’ll need these to complete the flow.

With the application credentials in hand, you’re ready to get an access token! To do that, you’ll need to use the authorization server’s token endpoint that you found in the introduction exercise. Look up the URL from your notes or copy it from the introduction exercise.

Since this is a machine-to-machine flow, there is no user involved in the flow so there is no browser involved either. The application can make a direct request to the authorization server’s token endpoint to get an access token. If you’re using curl, replace the placeholder values in the request below with your own. (Make sure to replace the curly brackets, those are just to indicate placeholder values.)

If everything worked, you’ll get a response that includes an access token! Paste the entire response (not just the access token) below to check your work!

Token Response

Use the client credentials grant to get an access token, then paste the entire token response JSON here to check your work