Enable MFA
Call enableMFA with the user's LoginParams to start the multi-factor authentication (MFA)
setup flow.
For custom authentication, include the connection ID and identity token.
tip
Additionally you can associate a function to be triggered on successful MFA Enabled.
void Start()
{
web3Auth = GetComponent<Web3Auth>();
web3Auth.setOptions(new Web3AuthOptions()
{
});
web3Auth.onMFASetup += onMFASetup;
}
private void onMFASetup(bool response)
{
// Functions to be called after MFA setup
}
Usage
- Default Verifier
- Custom JWT Verifier
public void enableMFA()
{
var options = new LoginParams()
{
authConnection = AuthConnection.GOOGLE
};
web3Auth.enableMFA(options);
}
public void enableMFA()
{
var options = new LoginParams()
{
authConnection = AuthConnection.CUSTOM,
authConnectionId = "<YOUR_AUTH_CONNECTION_ID>",
extraLoginOptions = new ExtraLoginOptions()
{
id_token = "<YOUR_ID_TOKEN>",
userIdField = "sub",
prompt = Prompt.LOGIN,
}
};
web3Auth.enableMFA(options);
}