Auth0 Home Blog Docs

Multi Factor Auth ... using Google Authenticator and auth0-guardian.js

google-authenticator
multi-factor-auth

#1

Using auth0-guardian.js in my angular single page application works fine besides throwing an “no enroll methods” error. I activated Multi-Factor-Auth by navigation to the menu item in the dashboard, leaving Push and SMS unchecked switching to Google Authenticator enabling it. How could I enroll manually? Why is there an no enroll methods error?

I edited the login rule to

function (user, context, callback) {
  // Uncomment the following to skip MFA when impersonating a user
  // if (user.impersonated) { return callback(null, user, context); }

  var CLIENTS_WITH_MFA = '***'];
  // run only for the specified clients
  if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) {
    // request a second factor only from users that have app_metadata.use_mfa === true
    if (user.app_metadata && user.app_metadata.use_mfa){
      context.multifactor = {
        provider: 'google-authenticator',

        // optional
        issuer: 'pages', 

        // optional, defaults to true. Set to false to force Google Authenticator every time. 
        // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details
        allowRememberBrowser: false 
      };
    }
  }

  callback(null, user, context);
}