Unity MFA not working properly

The Unity SDK is returning inconsistent results. I tested the below without the MFA settings and it works as expected. I compared the results to signing with Open Login and it’s returning two different private keys for the same Google account, hence I assume it’s working as expected.

However MFA seems problematic:

  1. the MFA settings are not working properly. What ever I enter as parameters in
            mfaSettings = new MfaSettings(
                new MfaSetting(false, 4, false),
                new MfaSetting(true, 1, true),
                new MfaSetting(false, 2, false),
                new MfaSetting(false, 3, false)
              ),

the 2FA factors always starts with the Device backup.

  1. After having entered a name for the device back, the social login window appears but it’s broken, the social logins do not appear and there is an error in the browser

index-1ac9d2ba.js:7 [Vue warn]: Error in 1: "TypeError: Cannot read properties of null (reading 'charAt')"

(found in <Anonymous>)
(anonymous) @ index-1ac9d2ba.js:7
  1. Reloading the page prompts the user for SFA again, this time redirecting to the properly populated Social page.
  2. The phone option did not work, I never received any SMS
  3. The email option returns the following error message after having validated the link from the email
Error
Something went wrong
Could not get result from torus nodes verifier web3auth-auth0-email-passwordless-sapphire not found for account id: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

Similar error with Discord

Could not get result from torus nodes verifier web3auth-discord-sapphire not found for account id: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
    public void Login(Provider provider)
    {
        string verifier = "";
        TypeOfLogin typeOfLogin = TypeOfLogin.GOOGLE;
        string providerName = "";
        string clientId = "";

        switch (provider)
        {
            case Provider.GOOGLE:
                verifier = "solcraft-google-auth";
                typeOfLogin = TypeOfLogin.GOOGLE;
                providerName = "google";
                clientId = googleClientId;
                break;
            case Provider.FACEBOOK:
                verifier = "solcraft-facebook-auth";
                typeOfLogin = TypeOfLogin.FACEBOOK;
                providerName = "facebook";
                clientId = facebookClientId;
                break;
        }


        var loginConfigItem = new LoginConfigItem()
        {
            verifier = verifier, // get it from web3auth dashboard
            typeOfLogin = typeOfLogin,
            clientId = clientId,
        };

        web3Auth.setOptions(new Web3AuthOptions()
        {
            //redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"),
            clientId =  web3AuthClientId,
            network = Web3Auth.Network.SAPPHIRE_DEVNET,

            mfaSettings = new MfaSettings(
                new MfaSetting(false, 4, false),
                new MfaSetting(true, 1, true),
                new MfaSetting(false, 2, false),
                new MfaSetting(false, 3, false)
              ),

            //Optional loginConfig object
            loginConfig = new Dictionary<string, LoginConfigItem>
            {
                {providerName, loginConfigItem}
            }
        }); ;

        var options = new LoginParams()
        {
            loginProvider = Provider.GOOGLE,
            mfaLevel = MFALevel.OPTIONAL,
        };

        web3Auth.login(options);
    }

@gillesjo.walther Your issue has been forwarded to our Dev team and we will get back with an update.

@gillesjo.walther Please use new web3Auth unity sdk version. Let us know in case of any queries.

1 Like

Thank you I could obtain the dApp share with MFA!

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