Auth0 Rules Global object

Hello All,
We have a rule which is making an API call to get access token . So, for every user after successful login we are making a call to get access token . Sometimes we are getting 429- Too many request while getting access token . So we are thinking of cache the token in global object and use the same instead of making multiple calls.

As per the documentation global object is webtask container specific . Let us assume there is a rule which will gets executed after every successful login . Imagine two users are getting logged into our application and in this case the rule will gets executed two times . Now will both rules have same webtask container or different one?

Hi @pradhapreee,

I know that all the rules will run in the same container for one user during a single authentication transaction, but I cannot confirm they will persist for multiple users. Here is more info on containers:

This line suggests that the global object can be shared between user’s flows, but I cannot say for sure. It may require some testing to find out as I cannot find a definitive answer at the moment. I can test tomorrow if you need.

The global object can also be used to cache expensive resources, such as an Access Token for a third-party (e.g., logging) API that provides non user-specific functionality or an Access Token to your own API defined in Auth0 and obtained by using Client Credentials flow.

Take a look at this doc that describes the global object, as there are some other constraints that may effect your strategy:

Let me know if this helps.

Thanks,
Dan

Hello Dan,

Thank you for replying. I tried to replicate the scenario which I have mentioned above .Out of 15 attempts I have made I found only in one attempt token has been taken from global object without making API call.
Can you please test the same at your end and confirm the same , Then I can be more confident on this solution.

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