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

1 Like

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!

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