A user's app_metadata is not available in post-login Action event

We have a pipeline of post-login Actions that execute for our users.

  • Action 1 sets some app_metadata against the user on first login only, which works great
    ** We can see that is set (permanently) after the fact by querying the user
  • Action 2 attempts to use this metadata on every login, first and subsequent
    ** Whilst the metadata is permanently attached to the user by Action 1 it is not available to Action 2 in subsequent logins

The docs here seem to suggest a user’s app_metadata will be available in the Action event object but it isn’t, only the metadata set in the current execution of the login pipeline is.

There is the option to query the user via the Management API on subsequent logins but the documentation does not state this is required and seems to suggest it shouldn’t be.

Is this a bug that a user’s app_metadata is not available in the post-login action?

Hi @stuart.forrest,

Welcome to the Auth0 Community!

I understand that you have been having problems getting the user’s app_metadata when using a Post-Login Action.

After testing this myself, I was not able to reproduce your observed issues. Instead, I could create 2 Action scripts, where the first script would set some app_metadata, and the second script would check for this metadata and perform some logic. In both the first and subsequent logins, the user’s app_metadata can be fetched in the Actions scripts and execute my custom logic.

Given that, there aren’t any bugs with the way the Post-Login action script is supposed to work.

In this case, could you please share with me your 2 Action scripts for me to try to reproduce your issues?

Thank you.

I was being an idiot, repeatedly. You can ignore this :slight_smile:

1 Like

Hi @stuart.forrest,

We’ve all been there. I’m glad everything is working now!

Please let me know if there’s anything else I can do to help.

Thank you.

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