Hi,
How do I know a user logged in or signed up? This is the example im using How to add Auth0 Authentication to a Vue.js Application in 7 steps. | Storyblok
Is there a property included in authResult I can use to know if the user just signed up?
handleAuthentication() {
return new Promise((resolve, reject) => {
webAuth.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.expiresAt = authResult.expiresIn
this.accessToken = authResult.accessToken
this.token = authResult.idToken
this.user = authResult.idTokenPayload
resolve()
} else if (err) {
this.logout()
reject(err)
}
})
})
markd
February 1, 2020, 5:34am
2
Hi @tylerflemingmn ,
Welcome to the Auth0 Community! A user’s profile has created_at
, last_login
, and logins_count
attributes that you can likely use. If logins_count
is ‘1’, the user just registered. You can include these attributes in your ID tokens if you like.
{
"created_at": "2020-02-01T05:30:24.714Z",
.
.
.
"updated_at": "2020-02-01T05:30:25.625Z",
"last_login": "2020-02-01T05:30:25.625Z",
"logins_count": 1,
}
Mark
1 Like
Thanks you for this info!
Im trying to get that info and im not retrieving any of that info. How is this possible via JS or via .NET?
markd
February 3, 2020, 11:56pm
4
You’ll want create a rule that adds the attribute or attributes that you are interested in to the ID token and / or access token. This is called “custom claims ”. This thread might help:
Hi @rjourdan_net ,
If there are additional profile attributes that you want to see “all the time”, probably the simplest solution is to add the attributes you are interested in to the user’s id_token and / or access_token. You can add additional attributes, “custom claims ”, to one token and / or the other dynamically using a Rule . For example:
You can add the entire user_metadata or app_metadata as a single custom claim, though I would suggest the above approach of adding just the attributes …
1 Like
system
Closed
February 18, 2020, 11:56pm
5
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.