promptForMFA

Updated:
Supported Platforms:
UUX

Launches the platform's multi-factor authentication work flow.

promptForMFA launches the platforms multi-factor authentication work flow. This method will return a promise that resolves or rejects when the user completes or cancels the workflow respectively.

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.

Details

Type

tecton.sources.promptForMFA({ message?: string }): Promise<void>;

Example

A common use case in a banking application would be to prompt the user for multi-factor authentication when they are attempting a transaction.

tecton.sources.promptForMFA().then(() => {
  return tecton.sources.requestExtensionData("/createTransaction", {
    toAccount: 123123,
    fromAccount: 64521,
    amount: "5.00",
    memo: "My Transaction"
  })
  }).catch(() => {
  tecton.actions.showModal({
    title: "Transaction Failed"
    message: "Multi Factor Authentication is required to complete this transaction.",
    modalType: "Error",
  });
});

/// 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

Arguments

UUX

Message on the modal. Replaces existing MFA messages.

message: 'MFA Codes are provided by our call center.'

Release Notes

Initial release

Added message argument