Connect Salesforce to Auth0
1
Salesforce setup
- Sign up for a Salesforce Developer account or use your existing Salesforce org.
- In your Salesforce org, navigate to Setup → Platform Tools → Apps → App Manager.
- Click New External Client App.
-
Fill in the basic information:
- Connected App Name: Enter a descriptive name for your integration
- API Name: This will be auto-generated based on the app name
- Contact Email: Your email address
-
In the API (Enable OAuth Settings) section:
- Check Enable OAuth Settings
- Callback URL:
https://YOUR_AUTH0_DOMAIN/login/callback
You can find the Auth0 domain in the Auth0 Dashboard.You can find this under Applications > [Your Application] > Settings > Basic Information > Domain.If you are using the custom domains feature, your Auth0 domain is the custom domain. You can find this under Branding > Custom Domains.- Selected OAuth Scopes: Add the following scopes:
api- Access and manage your data (api)refresh_token- Perform requests on your behalf at any time (refresh_token, offline_access)openid- Access your identity URL service
-
Important Token Configuration (for optimal Token Vault compatibility):
- Require Secret for Web Server Flow: Check this option for enhanced security
- Require Secret for Refresh Token Flow: Check this option to secure token refresh operations
- Enable Refresh Token Rotation: Check this option to enable rotation on each refresh
- Issue JSON Web Token (JWT)-based access tokens for named users: check this option, it provides longer token validity and better performance
- Click Create and wait for the app to be created.
- After creation, note your Consumer Key (Client ID) and Consumer Secret (Client Secret).
2
Auth0 setup
Token Vault configuration example
To configure the Token Vault for your Salesforce connection, you can use the following code snippet in your application:Troubleshooting
Invalid Grant Errors
If you encounterinvalid_grant errors with expired access/refresh tokens:
- Check token configuration: Ensure your Connected App uses JWT tokens instead of opaque tokens.
- Verify refresh token policy: Set the refresh token policy to “valid until revoked” in your Connected App.
- Scope configuration: Confirm that the
refresh_tokenandoffline_accessscopes are enabled in both your Salesforce Connected App and Auth0 connection. - Token rotation: If using refresh token rotation, ensure your application handles the new refresh token returned with each refresh request.
Common Issues
- Scope errors: Ensure all required scopes are enabled in your Salesforce Connected App settings, not just requested in Auth0.
- Token expiry: JWT tokens have longer expiry times than opaque tokens. If using opaque tokens, expect frequent token refreshes.
- Multiple authorizations: Avoid authorizing the same user multiple times rapidly, as this may cause token invalidation issues.
Next steps
- To learn how to configure applications to access Token Vault, read Configure Token Vault.
- If your application uses Organizations, authenticate the user with the target organization before initiating the Connected Accounts flow. Connected accounts remain linked to the individual user profile.
- To learn how to get an access token to make a tool call, complete the Call other’s APIs on user’s behalf Quickstart.