Can I get user last_name and first_name on first login with passwordless magic link?

I need to get user last name and first name on first login through magic link.

Hi @zakhar.levchuk,

Welcome to the Auth0 Community!

After a user has logged in with a Passwordless Magic Link, there is an option to use an Auth0 Post-Login Action to get the user’s first and last name.

Then to specifically check for the first login, you can add the if (event.stats.logins_count === 1) condition.

For example:

exports.onExecutePostLogin = async (event, api) => {
  if(event.stats.logins_counts === 1 ){
    var firstName = event.user.given_name
    var lastName = event.user.family_name

See the Actions Triggers: post-login - Event Object for the complete list of callable properties.

Please let me know how this works for you.


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