Cache a machine to machine access token used in rules

I have seen some posts here regarding using global to cache a machine to machine access token (Management API) for use in rules. It seems this works between the various rules that are executed upon authentication.

Any suggestions on how to cache a token across all authentications. It seems that acquiring an access token on each authentication is excessive if a token lasts a day or so and can be shared.

Hi @vigi

The trick is to use the rules’ config variables as the cache. A config variable can be updated with the Auth0 Management API:

managementClient.setRulesConfig

There’s some code to wrap around that, of course, but that is the heart of the idea.

John