Is it possible to access secrets in Actions outside of onExecutePostLogin function?

Hi there!

Is it possible to access secrets in Actions outside of onExecutePostLogin function definition? Inside the function we can access a secret by calling event.secrets.

Currently we initialize a client inside the function but that seems to be triggered on each user login (it’s a Login flow action). I want to move the client initialization outside but it requires reading the secrets.

Thanks!

1 Like

There are few ways you can achieve this:

  1. pass the secret value to the function as a parameter.
  2. use global variables and assign the secret value at the beginning (not recommended)

I hope it helps. :slight_smile:

We initialize a third-party service client inside of onExecutePostLogin and it’s being initialized on each user login which might exceed the rate limit. I guess option number 1 is only one to go with but we would need to use api.cache.

We initialize this client in multiple actions. Is there a way in Auth0 to reuse some piece of code logic across multiple actions?