How can I detect first login after email verification

I want to assign app-token to my user. So, I need to detect first login after the email verification. How can ı implement this?

1 Like

Hello @ramazan ,

Do you mean retrieving access token whenever user logins? Whenever a user authenticates, an access token which includes the target audience and scope of access will be returned.

Why do you have the need to detect first login after email verification?


1 Like


As I mentioned above, if I can detect the first login after email verification, I will define the virtual credit that I created in the my app to the users.

So I don’t need to check every login. Instead I just need detect the first login after email verification.

1 Like

Hello @ramazan ,

Thanks for clarifying.
You can detect first login by creating a Post login action and checking for event.stats.login_counts.

For example, you can create a rule to detect first login (counts ===1) and assign app-token there.

exports.onExecutePostLogin = async (event, api) => {
  if(event.stats.logins_count === 1){
    //assign app-token here
    //not first login

This is quite similar to a use case in the Community and attaching for your reference.

Let me know how it goes, thanks!


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