exports.onExecutePostLogin - event.organization null

I have users in an organization. When I login as them exports.onExecutePostLogin executes but event.organization is always null. How can I fix this?

I see in this doc that its optional but I am unsure how to add it to event.

Actions Triggers: post-login - Event Object (auth0.com)

Hi there @dfleming welcome to the community!

Do you mind sharing your action code so we can take a look?

I might also recommend taking a look at your token(s) at jwt.io - Do you see an org_id added as a claim? Here’s an example of what that would look like when a user is authenticated through an organization:

I don’t want to authenticate a user through an organization because I won’t always know what organization the user is going to be in at the time of the redirect to /authorize.

I need to know their org during onExecutePostLogin (or using a rule multifactorAuthentication) so I can present them the MFA challenge based on their organization metadata.

Can I use the management API in a rule or action to look up a user’s org since event.organization is null?

Gotcha, thanks for clarifying!

You could get the organizations a user belongs to using the Management API /api/v2/users/{id}/organizations. Some more on utilizing the Management API from within an action here:

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