Email Verification Stays at Pending in Auth0 Dashboard with Automatic Verification Email

Our team is facing an issue where the email verified status is not reflected in the Auth0 dashboard even though it has been updated in the custom database when done through the automatic magic link which is sent to users on signup. However, manual configuration of the verification email through the API works just fine.

Attached Screenshot of the Issue
Log Shows User Has Been Verified

But On Dashboard Status stays pending

Custom Create User Script

function create(user, callback) {
  const bcrypt = require('bcrypt');
  const MongoClient = require('mongodb@4.1.0').MongoClient;
  const client = new MongoClient(configuration.mongodbUri);
  client.connect(function (err) {
    if (err) return callback(err);
    const db = client.db('DevDB');
    const users = db.collection('users');
    users.findOne({ email: user.email }, function (err, withSameMail) {
      if (err || withSameMail) {
        client.close();
        return callback(err || new Error('the user already exists'));
      }
      bcrypt.hash(user.password, 10, function (err, hash) {
        if (err) {
          client.close();
          return callback(err);
        }
        user.password = hash;
        user.email_verified = false;
        users.insert(user, function (err, inserted) {
          client.close();
          if (err) return callback(err);
          callback(null);
        });
      });
    });
  });
}

Custom Verify User Script

function verify (email, callback) {
  const MongoClient = require('mongodb@4.1.0').MongoClient;
  const client = new MongoClient(configuration.mongodbUri);
  client.connect(function (err) {
    if (err) return callback(new Error(email,"Custom Error Message"));
    const db = client.db('DevDB');
    const users = db.collection('users');
    const query = { email: email, email_verified: false };
    users.update(query, { $set: { email_verified: true } }, function (err, result) {
      client.close();
      if (err) return callback(err);
      callback(null, result.matchedCount>0);
    },{upsert:true});
  });
}
1 Like