paul5
July 31, 2019, 2:17pm
1
Hello,
We would like to show some language to a user if they have just created their account and logged in for the first time. Is there a way for us to tell if a user is logging in for the first time during or after the auth callback?
Thanks,
Paul
Within Rules, you can check context.stats.loginsCount===1
and i.e. add a custom claim to your ID token to handle it accordingly on your client side.
For example:
function (user, context, callback) {
const namespace = 'https://myapp.example.com/';
context.idToken[namespace + 'is_new'] = (context.stats.loginsCount === 1);
callback(null, user, context);
}
Learn about the properties of the Rules context object, which stores information about users' IP addresses, applications, and location.
Similar threads in this forum:
2 Likes
paul5
August 1, 2019, 9:39am
3
Fantastic, will give that a go. Many thanks!
1 Like
system
Closed
August 16, 2019, 9:39am
4
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.