Rule to Call Webhook when existing user registers for a new app

Hey all,

I’m working on a Auth0 org that has several front end apps, but has shared users across those apps.

For one of the apps (let’s call it “App A”), we want to call a web hook to pass the known user info to a webhook. This article was extremely helpful for that: https://auth0.com/docs/hooks/extensibility-points/post-user-registration

Unfortunately, it seems that users that already have an account with “App B” are not calling that webhook when they log into “App A” for the first time (which is the desired behavior).

Is there a similar event or flags on the context argument of the rule that I can leverage to make this happen?

Thanks!
Zack

Hi,

You can differenticate every call on the basis of application id. Every call have a application id which can be use to uniquly identify the call.

Right, but is there a way to tell from the context if that call is the first instance of the user logging into the app that corresponds to the application id?

Also, are all properties of that context argument documented somewhere?

Yes, you can find all available properties of context object below:

1 Like

Thanks! I wish that the context.stats was more fully fleshed out - not sure what all that holds, but I’m using that loginsCount to figure out if it’s the user’s first login or not (per the demo), and that’s what’s producing my issue, since the loginsCount is actually much higher than 0 if the user has logged into ‘App B’.

Any chance there’s further documention on the stats?

If you need to create a specific scanario you put any extra variable in user_metadata field and utilize that fields anywhere in rule.

1 Like

Unfortunately there isn’t…

It’s the only reference regarding stats property in context object:

if you want to explore it more I would go for console.log method.

Thanks @konrad.sopala - if I console.log inside of a rule, how can I see the output? Is there some log file that gets generated/accessible via the dashboard?

Hi,

You need to installed and extension name Real-time web-task logs. See screenshot below for further:
image

1 Like

Thanks for sharing that Rashid!

1 Like