Auth0 Home Blog Docs

Add server response as payload to access token



With Auth0, is it possible to add a response from a webserver as a payload to the access token?

Context: A user logs into our web app (or mobile app) and gets an access token from Auth0. With the access token in the authorization header, the web app then makes a request to our backend to get a “Twilio Auth Token”. The Twilio Auth Token(*) is a special token that contains information about the Twilio client and the logged in user.


Instead of having our web app asking our backend to get the Twilio Auth Token, is it possible that we configure a rule (or something else) in Auth0 that fetches the Twilio Auth Token from our backend (via a GET request and the OAuth access token from Auth0) and then add the Twilio Auth Token as a payload to the access token?

By doing so, we save our web apps and mobile apps from fetching and also refreshing the Twilio Auth Token if it would be already part of the access token created by Auth0.

Is this use case implementable with Auth0?

Best wishes,