Using a Backend Service for Native to Web Custom Token Exchange in Auth0
Last Updated:
Overview
When generating a Native-to-Web Custom Token Exchange from a backend service rather than a native application, Auth0 requires the application type to be Native. Resolving this configuration conflict requires a dedicated Native application in Auth0 specifically for the Custom Token Exchange endpoints, while a separate Machine-to-Machine (M2M) or Regular Web Application handles other API calls. Additionally, the backend service must set the enforce_device_binding parameter to "none" to ensure the token functions correctly when passed to the end-user device.
Applies To
- Auth0
- Native to Web Custom Token Exchange
- Backend Services
- Token Generation
- Device Binding
Solution
How is a backend service configured for Native to Web Custom Token Exchange?
Create a dedicated Native application in the Auth0 Dashboard for the CTE endpoints and configure the backend service to bypass device binding by following these steps:
- Navigate to the Auth0 Dashboard.
- Go to Applications and select Applications.
- Choose Create Application.
- Enter a descriptive name for the application.
- Select Native as the application type and choose Create.
- Navigate to the Settings tab of the newly created application.
- Locate the Client ID and Client Secret to use exclusively for the Native-to-Web CTE endpoints in the backend service.
- Configure the backend service to include the
enforce_device_bindingparameter set to"none"when making requests to the CTE endpoints. - Create a separate Machine-to-Machine (M2M) or Regular Web Application in the Auth0 Dashboard to handle all other Auth0 API calls.
NOTE: The backend service must set enforce_device_binding to "none" because it generates the token on one device and passes it to the native application on a different device.