When a user REGISTERS into our app, he is led into the login flow, where he sets up the MFA, enters the code and then he SHOULD land on to the Dashboard. But he doesn’t land on dashboard. the Flow gets stuck after authentication (MFA)
When a registered user LOGS IN, he is led to MFA too, enters the 6 digit code and he lands onto the Dashboard as expected. The Dashboard URL is set as “Allowed Callback URLs” in Auth0 settings.
I can’t figure out WHY the user does NOT land on the dashboard in the first case (Registration). This is where I need help please
function login(e) {
console.log('Inside the login function')
e.preventDefault();
var button = this;
var username = document.getElementById('email').value;
var password = document.getElementById('password').value;
button.disabled = true;
webAuth.login({
realm: databaseConnection,
username: username,
password: password,
captcha: captcha.getValue()
}, function (err) {
if (err) displayError(err);
button.disabled = false;
});
}
async function signup() {
console.log('Inside the signup function')
var button = this;
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
var username = document.getElementById('username').value;
console.log('Checking BEFORE whether an invite has already been sent or not');
const inviteSent = await hasAnInviteBeenSent(email);
console.log('hasAnInviteBeenSent function call successful');
if (!inviteSent) {
emailErrorMessage.innerText = "You need to be invited to register. Please request an invite first. If you have already requested an invite, please check your email. If you still haven't received an invite, please contact us at support@sandboxwealth.com";
return;
}
button.disabled = true;
console.log('Calling the webAuth.redirect.signupAndLogin function')
console.log(webAuth)
markUserAsRegistered(email);
try {
webAuth.redirect.signupAndLogin({
connection: databaseConnection,
email: email,
password: password,
username: username,
captcha: captcha.getValue()
}, function (err) {
console.log(" Printing the Err object ");
console.log(err);
if (err) {
console.log(err);
displayError(err);
console.log('Signup Callback: Error in the webAuth.redirect.signupAndLogin function')
UnregisterUser(email)
}
button.disabled = false;
});
} catch (err) {
UnregisterUser(email)
console.error('Errors in the webAuth.redirect.signupAndLogin function', err);
displayError('Errors in the webAuth.redirect.signupAndLogin function. Please try again later' + err);
}
console.log('Called the webAuth.redirect.signupAndLogin function');
// markUserAsRegistered(email);
}
I am using webauth.login for Login and webauth.redirect.signupandLogin.