Under what conditions is `event.transaction (optional)` part of the event?

In my post-user-registration action, I’m trying to get the event.transaction as is documented here. It says it’s “optional,” but when does it actually show up?

Context is, I need to know which organization or application the user signed up under. I’m creating an invite and adding the client_id to the ticket (I think it’s required anyway) so the invite should know both the org and the client that I’m intending the user to be signed up for.

Problem is, when the post-user-registration action, there is no event.transaction, and therefore no event.transaction.redirect_uri that I can use. There also no org as part of that event.

I’ve tried other things as well, such as adding user_metadata when sending the invite (seems to not work possibly because the user doesn’t actually exist yet) and I’ve tried adding metadata at the pre-user-registration action as well and that doesn’t work. I doubt cache will help since it’s only good for 24 hours at the most and an invite could sit around longer than that.

Bottom line: how can I set the org and/or client (known at time of invite creation) and then be able to retrieve it (or something close enough, like the redirect_uri) in the post-user-registration action?

Thank you for posting your question, @mherzig !
I appreciate you describing the border context and the steps you have already verified.

After investigating what’s available, I want to check with you if the following workaround will address your use case:

In your post-user-registration Action, you can initialize the Auth0’s Management API client and call the GET /api/v2/users/{id}/organizations endpoint to retrieve the organization the user registered.

Working with the Management API in Actions requires some steps on your side and these resources can be relevant for you:

There is a product request feature (on accessing the organization ID from the pre/post user registration flow) that you could upvote.

Please let me know if you are any other questions on this topic I could help with!

Thank you, I did go and upvote that feature request.

I’m not sure that the endpoint you mention helps in all cases–for example, if someone is invited to OrgA and then some time later to OrgB, I would see both of those in the response but I wouldn’t necessarily know which org invite is the one that was just clicked on. To do that, I’d want to be able to have that “baked in” to the invite ID and then returned with the actions.

Alternatively, or possibly in addition, it would be good if the user_metadata could also be kept as part of the invite and then copied into the user when they actually do get created.

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