Different redirect for users who have logged in with previous accounts vs users who have just signed up


I am having trouble redirecting users who have just signed up compared to those who have logged in with previously existing accounts. First of all, is this even possible? and if so, it would be great if i could get any advice!

Hi @linustalacko,

We expose the user’s login count in post-login actions/rules, which you can use to detect the user’s first time logging in. This is available as event.stats.logins_count in post-login actions or context.stats.loginsCount in rules. You can use this to add a custom claim to the user’s id token which your application receives after the user logs in. Then you can write custom redirect logic in your application based on this custom claim.

Here is an example of adding a custom claim in a post-login action: Login Flow
And our guide for custom claims in rules: Sample Use Cases: Scopes and Claims

Hope this helps!


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