Last updated: Nov 6th, 2024
Overview
If a user cannot satisfy Multi-Factor Authentication (MFA) requirements, they will be stuck on the MFA page without a way to invalidate their session to sign in as a different user. Refreshing the page to sign in with a different account will skip the login page and return the MFA challenge. This article explains how to return to the login prompt so that users can change their credentials if necessary.
Applies To
- Multi-Factor Authentication (MFA)
- Login Page
Solution
This can be achieved by including a link in the page template (Customize Login Pages) that points to a different page that logs the user out and then redirects them back to the login page.
- It is not possible to include the link on the widget itself, but it is possible to have the link appear above or underneath the widget.
- Here is an example of a page template that includes this link that only appears on the MFA pages:
<!DOCTYPE html>
<html lang="{{locale}}">
<head>
{%- auth0:head -%}
<title>{{ prompt.screen.texts.pageTitle }}</title>
</head>
<body class="_widget-auto-layout">
{% if prompt.name == "mfa-otp" or prompt.name == "mfa-recovery-code" %}
<div class="prompt-wrapper">
<a href="https://YOUR_LOGOUT_LINK">Click here to Change Accounts</a>
{%- auth0:widget -%}
</div>
{% else %}
<div class="prompt-wrapper">
{%- auth0:widget -%}
</div>
{% endif %}
</body>
</html>
To see this functionality in a future release of Auth0, please vote for this feature request in the Auth0 Community.