How to reload user object in rules

I have a rule that redirects to my app, which updates the user metadata and then triggers the continue. However, I need to access the new metadata so I can include it in the access token, but the redirect doesn’t reload the user. So how can I do it in the rule?

Hi @calvin2,

One of the Auth0 engineers may correct me, but I don’t think you can manually reload the profile data. Profile data is read before the rules begin execution. In this case I believe you need to update the metadata and update the token yourself.

Ref: https://cdn.auth0.com/blog/auth0-raises-100m-to-fuel-the-growth/inside-the-auth0-engine-high-res.jpg

1 Like

Sorry for the late reply! @markd is right, but I would like to add some additional information.

The user object is a snapshot that gets created when a user authenticates and before rules run. While this can’t be refreshed, it can be updated. If you make changes to a user’s metadata and need those changes to be available in subsequent rules, you can achieve this by updating the user object with the same changes that were made to the user’s metadata.

2 Likes

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