onContinuePostLogin is not triggering after MFA

Hi All,

I am using Actions to enable MFA in the onExecutePostLogin. But after successful MFA validation the onContinuePostLogin method is not triggered. I need to re-direct the user to a different URL after this.

Is there any way I can re-direct the user to a different URL after successful MFA? Can I do this with actions?

exports.onExecutePostLogin = async (event, api) => {

  api.multifactor.enable("any");
};

exports.onContinuePostLogin = async (event, api) => {
//Not triggred
}

Thanks

Hi @kiran.b.chandran,

The onContinuePostLogin function will only trigger if you first redirected your user to another URL.

Then you must call the /continue endpoint to complete the authentication flow.

For example:

https://{yourAuth0Domain}/continue?state=THE_ORIGINAL_STATE

Please see Redirect with Actions.

You need to call the api.redirect.sendUserTo() method to redirect your users.

Thanks,
Rueben

Hi @rueben.tiow,

I need to get a callback to onContinuePostLogin after completing the Auth0 Default MFA.
So to which URL I should re-direct the user to get this behavior?

Thanks

Hi @kiran.b.chandran,

You need to redirect your users to whatever URL you prefer using the api.redirect.sendUserTo() method.

Once you get redirected to that page, you can send the user back to Auth0 to resume authentication by calling https://{yourAuth0Domain}/continue?state=THE_ORIGINAL_STATE.

Then at this point, you can initiate your Multi-factor Authentication process.

See below:

exports.onExecutePostLogin = async (event, api) => {
  api.redirect.sendUserTo("https://yourURL.com");
};

exports.onContinuePostLogin = async (event, api) => {
  api.multifactor.enable('any')

Thanks,
Rueben

Hi @rueben.tiow,

The issue is if I use api.multifactor.enable(‘any’) in onExecutePostLogin the onContinuePostLogin is not triggered.

Is there any way to make this work?

Thanks

Hi @kiran.b.chandran,

Unfortunately, no. This is not possible.

You could leverage the Callback URL (redirect_uri) if you want to redirect the user after MFA.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.