Auth0 - management API tokens

Options
I wanted to get management API tokens for Auth0, so that i can update user profile pictures, first name, last name etc.

How should i be getting these Management API tokens into auth0? the issue is that these tokens last for several hours, so can be used multiple times.

Comments

  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options
     good question!

    The first part is getting the API request working to generate that token. I'm pretty sure that is a simple curl import from their documentation page. If you need help with that, let me know.

    The 2nd thing is what is the best way to retrieve this since it is a multi-use but temporary token. This becomes super easy with function caching.

    Make a function in xano that is called get_management_token. Inside that do the API request and then return that token. Then go to your function settings and set function caching to whatever makes sense - I would pick a time that is slightly less than the total time the token is available for because sometimes you can have clock skew where timing is slightly off. If its a 3 hour token, then set function caching for 2.5 hours, etc.

    This way you automatically reuse the same token so its super fast.