Auth0 Home Blog Docs

Universal Login - Vue - How to know if a user logged in or signed up?

Hi,

How do I know a user logged in or signed up? This is the example im using https://www.storyblok.com/tp/how-to-auth0-vuejs-authentication

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)
      }

    })
  })

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

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?

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:

1 Like

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