Adding and managing M2M apps
Requesting a machine-to-machine client and calling an API with it
A machine-to-machine (M2M) app is a client with no user present: a backend service, a job, or a script calling an API on its own behalf. This page walks through requesting one, getting a token, and making a first authenticated call. See Registering an app for how M2M compares to the other app types.
Before you start
- Access to the sandbox tenant
curlandjq, or an HTTP client of your choice
1. Request a client
Use the appropriate link below to request a client for your app.
- Request Auth0 Sandbox Access
- Request Auth0 API Resource
- Request Auth0 M2M App
- Request Auth0 Resource Update
2. Store your credentials
Keep the client secret out of source control. Use the secret store your app already uses.
3. Request an access token
The response contains an access_token and its lifetime in expires_in. Cache the token and reuse
it until shortly before it expires rather than requesting one per call.
4. Make your first request
5. Confirm your scopes
A 403 with a Missing required scope message means the token is valid but the client is not
authorized for that operation. See Assigning scopes to M2M apps.
What to do next
- M2M requirements and best practices for token handling in production
- User management for the most common user operations
- Error codes for what a failed response means