Configure Your Application For M2M Access

After creating the application, configure it for machine-to-machine access by following these steps:

  1. Define organization behavior for each API you need to access.

  2. In cases where the application should only access specific organizations i.e. not all of them, Authorize M2M Access for each API you need to access for those specific organizations.

Define organization behavior

You can configure how your application uses Organizations during the Client Credentials Flow for each API, such as whether the application must use an organization or can access any organization or only explicitly associated ones.

The following table explains the fields for defining organization behavior for M2M access:

Define organization behavior table

Field Description API Mapping
Organization Support Determines how this application may use organizations when accessing via the Client Credentials Flow.


Options include:

  • None: The application must not use organizations. This is the default value.
  • Optional: The application may decide whether to use an organization.
  • Required: The application must use an organization.
Organization Support maps to organization_usage.


Options:

  • None maps to deny
  • Optional maps to allow
  • Required maps to required
Allow machine-to-machine access to any organization Determines whether this application can access any organization or is limited to a set of explicitly associated organizations when using the Client Credentials Flow. By default, this behavior is not allowed.


Warning: Enabling machine-to-machine access to any organization allows the application to access any organization without it being explicitly associated. It should only be enabled for trusted internal applications.

Allow machine-to-machine access to any organization maps to allow_any_organization.


Options:

  • Checked maps to true
  • Unchecked maps to false

Define organization behavior for an application

To define organization behavior for an application, use the Auth0 Dashboard or Management API.

For a machine-to-machine application, define organization behavior via the Auth0 Dashboard:

  1. Navigate to Auth0 Dashboard > Applications, and select the application for which you want to configure Organizations.

  2. Switch to the APIs tab and expand the client_grant details for the API you wish to configure access to. 

  3. Configure the appropriate settings as explained in the Define organization behavior table.

  4. Select Save.

Alternatively, if it is not a machine-to-machine application: 

  1. Navigate to Auth0 Dashboard > APIs, and select the API for which you want to configure Organizations access.

  2. Switch to the Machine To Machine Applications tab. It shows all applications, not just Machine-to-Machine applications. Locate your application. 

  3. To authorize access, click the toggle for your application. Then, click your application to expand the configuration details.

  4. Configure the appropriate settings as explained in the Define organization behavior table.

  5. Select Save.

Set default organization

Some clients do not support non-standard fields in the Client Credentials Flow. Therefore, they cannot send the required organization parameter to the /oauth/token endpoint. For these clients, you can set a default organization that is automatically applied to any Client Credentials request from the application when none is specified and organization support is required by the API.

The following table explains the fields for setting a default organization for machine-to-machine access:

Set default organization table

Field Description API Mapping
Default Organization for Machine-to-Machine Access Defines which organization to apply to Client Credentials requests that do not contain an organization Default Organization for Machine-to-Machine Access maps to the default_organization object with the following properties:
  • organization_id: The ID of the organization to use
  • flows: The authentication flow to use for the default organization.


    This setting is hidden in the UI and defaults to ["client_credentials"]

Set default organization for an application

To set the default organization for an application, use the Auth0 Dashboard or Management API.

To enable a default organization for an application via the Auth0 Dashboard:

  1. Navigate to Auth0 Dashboard > Applications, and select the application for which you want to configure.

  2. Select the Organizations tab.

  3. Configure the appropriate settings as explained in the Set default organization table.

  4. Click Save.