Trigger MFA specific page

Hi,

How do I trigger MFA on specific page?

Regards,

Hi @charles.nguyen-viet

Thanks for reaching out to Auth0 community!

Can you please explain a bit more on this, do you mean you want to trigger MFA for certain endpoint when user try to access, is that what your looking for?

Please check this documentation of Step-up MFA, Add Step-up Authentication

and if you want to trigger for certain endpoint the please go through this documentation. Configure Step-up Authentication for APIs

Regards,
Pavan.

Hi Pavan,

Thank you for your reply. I need to fire MFA on specific page
So I did the following.

1) Add this code in action script
exports.onExecutePostLogin = async (event, api) => {
const CLIENTS_WITH_MFA = [‘bdfgdfwmdV7GWCQxGk6P7WQJFkVZ’];
// run only for the specified clients
if (CLIENTS_WITH_MFA.includes(event.client.client_id)) {
// ask for MFA only if scope transfer:funds was requested
if (event.transaction.requested_scopes.indexOf(‘openid delete:users’) > -1)
//api.redirect.sendUserTo(“https://my-app.exampleco.com”);
api.multifactor.enable(‘any’, { allowRememberBrowser: false });
}
}

2)Then I fire this link to trigger MFA when user access to specific page

https://mytenant.auth0.com/authorize?audience=https://mytenant.us.auth0.com/mfa/&scope=openid%20delete:users&response_type=id_token%20token&client_id=bdfgdfwmdV7GWCQxGk6P7WQJFkVZ&redirect_uri=http://myWebPage.com/selectaccount&nonce=NONCE&state=OPAQUE_VALUE

  1. After it’s successfull, it redirects user this page(redirect_uri) with parameters
    mywebpage.com - This website is for sale! - mywebpage Resources and Information.
    &scope=openid&expires_in=7200
    &token_type=Bearer
    &state=OPAQUE_VALUE
    &id_token=eyJhbGciOiJSUzI…

After that, what should I do next to redirect user to the specific page ?

I’m using C#

Thank you
Charles