Auth0 Home Blog Docs

Account is already verified when new user created by management API clicks on link in verification email

verification-email
email-verification
create-user
user-management

#1

I am creating users via the management API like so:

var data = {
    'connection': 'Username-Password-Authentication',
    'email': email,
    'password': 'secret',
    'user_metadata': {name: email},
    'email_verified': false,
    'verify_email': true,
    'app_metadata': {}
}
auth0Client.users.create(data, function (err, result) {
    ...
});

The new user receives the verification email as expected, but when they click on the verify link inside the verification email, they get shown a ‘This account is already verified.’ message.

![alt text][1]

Any ideas how to fix this?


#2

I could not reproduce the situation so this may be something scenario specific. The reason I say this is because the verification email is just an URL that when accessed implies the email has been verified which means that if any automated process responsible for the delivery, processing or view of the email in question decides to access the URL (issue an HTTP GET request) then technically the email has been verified and when the user opens the email it’s already the second time the link is being accessed.

If you have a test account available I would recommend configuring a mailtrap.io account, setting it as the SMTP server in the Auth0 account and then do the user creation process like you’ve been doing. If trying to verify the email when you received the link and opened it through mailtrap works as intended then I would consider that the above guess about some automated process may have something to do with it.


#3