Auth0 Home Blog Docs

User metadata in verification email template is empty

Hi!

I’m trying to implement the following scenario:
Application admin creates new users(via management API), user receives invitation email with login details, user logs in and changes password.

I couldn’t find proper ‘configuration’ for that case, so I’m trying the following: upon user creation password being added to user_metadata(this part, obviously, works), in email template I’m trying to refer password: {{ user.user_metadata.initialPassword }} but this results in empty string.

(SendGrid is used as an email provider)

So, I’ve got 2 questions:

  1. Am I accessing this variable the wrong way?
  2. Is there any better way to achieve this scenario?

Thanks in advance.

Hi @Rasalom,

Welcome to the Community!

Check out this doc about invite only applications, it outlines a strategy that you can take ideas from.

You could also take advantage of this endpoint to initiate a password change:

Thanks,
Dan

Hi, Dan. Thanks for your reply.

I’ve checked guides around ‘invite only applicaitions’, but this doesn’t match required scenario, since there is no possibility to send ‘invite link’. Desired scenario:

  • admin creates user
  • user receives email with invitation link/credentials
  • user follows link
  • enters credentials
  • user redirected to password reset page
  • user resets password and logs in

Scenario from guide:

  • admin creates user
  • user receives email with verification link
  • user follows verification link
  • user receives another email, asking to change password
    //it means that user must know that they should open email once again and follow new link
  • user follows link from change password email
  • user resets password

The second one is not really user friendly, as you can see. I understand that second email is ‘required’ because it contains token for password reset, is there a way to have single email for verification/reset?

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