Skip to main content

Email verification for Auth0

Add MORE email address verification to your Auth0 authentication workflows to improve the quality of your data and protect your sign ups.
Email Hippo Auth0 Integration

Use Auth0 email verification integration

Auth0 is a leading identity as a Platform (IDaaS) service provider making Identity simple and secure.

 

By integrating Auth0 with Email Hippo, you can add another layer of security to your sign-up forms - checking users' emails for signs of fraud and abuse.

 

Our unique partner integration can be set up in minutes, with no coding knowledge required.

auth0_logo

/*
 * © 2020, Email Hippo Limited. (http://emailhippo.com)
 *
 * This example requires a valid key to work correctly.
 *
 * License: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
*/

```javascript--browser

function (user, context, callback) {

  user.app_metadata = user.app_metadata || {};

  // Users with the emailhippo_valid will return an error on login
  // Setting emailhippo_valid to true will allow the user to log back in
  const valid = user.app_metadata.emailhippo_valid;
  if (valid !== undefined) {
    return valid ? callback(null, user, context) : callback('Email address is not valid');
  }

  if(!user.email) {
    return callback(null, user, context);
  }

  const request = require('request');
  
  const key = configuration.HIPPO_API_KEY;
  
  // Sign up at https://www.emailhippo.com/
  const url = 'https://api.hippoapi.com/v3/more/json/'+ key +'/' + user.email;

  request({ url: url }, function (err, resp, body) {
    if (err) {
        return callback(null, user, context);
    }
    if (resp.statusCode !== 200) {
        return callback(null, user, context);
    }

    const hippo_resonse = JSON.parse(body);
    
    const result = hippo_resonse.emailVerification.mailboxVerification.result;
    const reason = hippo_resonse.emailVerification.mailboxVerification.reason;

    user.app_metadata = user.app_metadata || {};

    // Any email address that is either bad or a Disposable email address
    // will be flagged as invalid. You can add your own custom logic if you want.
    let valid = true;
    if (result === 'Bad' || (result === 'Unverifiable' && reason === 'DomainIsWellKnownDea')){
        valid = false;
    } 

    user.app_metadata.emailhippo_result = result;
    user.app_metadata.emailhippo_reason = reason;
    user.app_metadata.emailhippo_valid = valid;

    auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
      .then(function(){
        return valid ? callback(null, user, context) : callback('Email address is not valid');
      })
      .catch(function(err){
        callback(null, user, context);
      });
  });
}
/*
```

*/

Talk to us about your integration requirements

Want more information about a popular Email Hippo integration, or want to discuss an integration requirement that isn't covered here? Get in touch today and we'll help you find the best solution for you.
Email Hippo - Your Integration Requirements

Not yet using Email Hippo for your email verification?

What are you waiting for?

Trial our email verification for free. Register today for 100 free email validations. No credit card details needed to create your account.

Email Hippo Sign Up