I just started process to migrate our Auth0 rules to actions and I was able to map most of the field, but I still have problems with these:
Access auth0.baseUrl (used in rules).
Access user.user_id (used in rules).
Access updated context in different action.
Access auth0.baseUrl (used in rules).
We have for example setup request in current Auth0 rule to const url = ${auth0.baseUrl}/users` address. Is it possible to access auth0.baseUrl somehow also in Actions? If not, I thought about set it as environment variable (SECRET).
Access user.user_id (used in rules).
We have user.user_id field used a lot in our rules. For example with updating app metadata : auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
How to replace user.user_id in this situation?
Access updated context in different action.
Third question is about accessing updated context fields in another action. In one auth0 rule we update context object by:
I understand you are migrating your Rules to Actions!
You can add a secret to any action by following the steps under the “Add a Secret” section: Write Your First Action. Unlike Rules, you cannot add global variables that all Actions can access. You will need to add any variable an Action requires to each Action’s secrets.
You can access the user_id in an Action with event.user.user_id. Please see this doc for more information on the event object in a post-login Action: Actions Triggers: post-login - Event Object
To access the primary connection’s user_id, you can use event.user.identities[0].user_id.
Please let me know if you have any additional questions or run into any issues migrating to Actions!
thank you for your answer, but I am still struggling with question about updated context in different action, what you didn’t answer.
I will try to describe situation more:
We have first role called linkAccountsWithSameEmailAddress. In the end of this rule, we have update of context with some new fields:
Then we have another rule running right after linkAccountsWithSameEmailAddress called handleSocialSignups where we check context.linked. But how to pass these additional field from one action to another?
Thank you for your reply! I apologize for missing the bit about the updated context. Referencing this migration limitation doc, the passing of variables between Actions is not supported. If you have Rules that depend on passing of state or variable data between one Rule to another, you can consolidate those Rules into a singular Action.
Please let me know if you have any additional questions!