Launches the platform's multi-factor authentication work flow.
promptForMFA launches the platform's multi-factor authentication workflow. This method returns a promise that resolves when the user completes the workflow or rejects when the user cancels it.
tecton.sources.promptForMFA(promptOptions?: PromptOptions): Promise<void>;export interface PromptOptions {
message?: string;
code?: number;
}Prompt the user for MFA verification before performing a sensitive action.
tecton.sources.promptForMFA().then(() => {
return tecton.sources.requestExtensionData({
route: 'create_user',
body: { name: "Tecton", email: "tecton@q2.com" }
});
}).catch(() => {
tecton.actions.showModal({
title: "User Creation Failed"
message: "Multi Factor Authentication is required to create this user.",
modalType: "Error",
});
});When using the promptForMFA source, there are important details to keep in mind.
The front-end handling to provide the correct MFA workflow for the user is baked in to the online banking platform as of UUX 4.6.1.4 and supports all variations of MFA. This means that you only need the @mfa_validation_required decorator to add MFA to your extension. The SDK, Tecton, and the UUX platform will handle opening the MFA workflow via promptForMFA as needed depending on the user’s setup.
If you are supporting an older version of UUX, you will need to implement the front-end handling by using the promptForMFA capabilitity. The promptForMFA UI flow must be paired with the associated server-side enforcement. This is done by using the @mfa_validation_required decorator on the entry point's method that needs to be protected by MFA. If a request is attempted against an entry point that has this decorator but has not completed the MFA workflow, an exception will be thrown and the method will not be executed.
# The associated backend SDK method would look like this
from q2_sdk.core.http_handlers.tecton_server_handler import mfa_validation_required
@mfa_validation_required()
def create_transaction:
# Execute protected code
For more information, see our SDK documentation on Prompting for MFA.
promptOptions.messagepromptOptions.code