Calling Auth0 API inside Actions

I have a Pre-registration action in place where I am calling the /api/v2/users-by-email API. I have to send the Bearer token to get the details but they actually expire in a certain time and it becomes a little hard to change every time it expires.
Is there a way to access Auth0 API in a different way? Or is there a totally different approach that can work for this use-case? I am new to Auth0 so any help is appreciated! Thanks in advance!

Hi @nikhil-varma,

Thanks for contacting the Auth0 Community!

I understand that it’s cumbersome to keep changing the Bearer token to use the Management API in your Actions whenever it reaches expiration.

Have you taken a look at our Community FAQ on how to use the Management API in Actions? https://community.auth0.com/t/how-can-i-use-the-management-api-in-actions/64947

This should allow you to programmatically request the access token needed to use the Management API while keeping your token confidential.

You may also find the ManagementClient documentation useful: https://auth0.github.io/node-auth0/module-management.ManagementClient.html

Please let me know how this works for you.

Thank you.