Access token in Action flow

Hi there,

Is calling the M2M flow within an Action the only way for an Action to get an access token for an audience other than the management api?
Our login flow requires us to hit our backend api to retrieve some information that we set in the users access token claims. The api is authenticated through Auth0 jwts. We’ve been doing this with a post login action, but retrieving a new token each for each Action execution rapidly uses up the monthly M2M access token limit. I’m aware that Actions now have a cache we could utilize, but the documentation states it only lasts for 15 minutes at time.
Is there an easier way to do this that I’m missing? Any insight is appreciated :slight_smile:

Hi @Sally.terramera,

Welcome to the Auth0 Community!

Yes, that is correct :+1:!

Caching your M2M tokens in an Action is the best way to minimize the number of requests for a new token. And that is correct, our documentation here states that cached items will persist for a maximum of 15 minutes.

For most scenarios, this strategy should mitigate going over your M2M Auth Quota utilization.

I recommend checking out our Caching Management API Access Tokens in Login Action FAQ for more information on how to cache access tokens in an Action.

Please let me know if you have any further questions.

Thanks,
Rueben

1 Like

Great thanks for the confirmation Reuben! I’ll test it out next month when our limits reset :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.