"Invalid constructor params" & "Invalid environment settings"

Hey, we are using the Unity SDK in multiple Unity projects, our implementation seems to be solid in general, but since we started internal testing, in some devices Web3Auth & OpenLogin started to give some errors that we cannot replicate.

Both errors happen right after calling the login method and before any provider screen shows up.

The first one was OpenLogin giving “Invalid constructor params, network or sdk url”. On some devices it kept on giving the same error, and other devices never did. Removing app data or reinstalling the app didn’t help. Clean devices kept working, they never replicated it. Both iOS and Android builds had this. We have WebGL builds, also, but it seems to be working fine. We did some digging, couldn’t find anything. We saw that our Web3Auth Unity SDK version was fairly old(1.8.0) decided to update it. Screenshot:

We updated to 2.1.0. Now the problematic devices are stuck at another error: “Invalid environment settings” And this time the issue it seems to be happening before we’re redirected from Web3Auth to OpenLogin. Screenshot:


And this is the URL from that page, if that helps: Web3Auth

Details as requested:

  • SDK Version: 1.8.0 & 2.1.0
  • Platform: Unity (Android and iOS) (We also have WebGL builds but haven’t run into these errors in them)
  • Browser Console Screenshots: N/A because it happens on some mobile devices and not on web, it is considerably harder to get meaningful logs

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

Initialization code:

            _web3Auth.setOptions(new Web3AuthOptions()
            {
                clientId = clientId,
                redirectUrl =  uri,
                network = network switch
                {
                    "mainnet" => Web3Auth.Network.MAINNET,
                    "cyan" => Web3Auth.Network.CYAN,
                    "testnet" => Web3Auth.Network.TESTNET,
                    "aqua" => Web3Auth.Network.AQUA,
                    _ => Web3Auth.Network.TESTNET,
                },
                buildEnv = network switch
                {
                    "mainnet" => Web3Auth.BuildEnv.PRODUCTION,
                    _ => Web3Auth.BuildEnv.TESTING
                },
            });

            _web3Auth.onLogin += OnLogin;
            _web3Auth.onLogout += OnLogout;
        }

Our login code:

            var loginParams = new LoginParams()
            {
                loginProvider = loginProvider,
                mfaLevel = MFALevel.NONE,
            };
            
            if (options?.ContainsKey("email") ?? false)
            {
                loginParams.extraLoginOptions = new ExtraLoginOptions() { login_hint = options["email"] };
            }   
            
            _web3Auth.login(loginParams);

We are actively trying to get more information about whatever is happening on those devices, but it is significantly harder to access the browser logs from mobile devices that we don’t even own. And I am guessing the Unity logs won’t help as much anyway, since it is a somewhat independent implementation.

@ersagun Thanks for your patience.

Your issue has been forwarded to our Dev team and we will get back with further updates.

Hello again. We’ve finally discovered what caused this issue. I sent a pull request to web3auth-unity-sdk repository which fixes it. Change usages of ToLower into ToLowerInvariant by ersagunkuruca · Pull Request #33 · Web3Auth/web3auth-unity-sdk · GitHub Thank you.

Thanks!

Our team will review this and get back with an update.

Released 2.1.1 with your fixes.
Thanks for your contribution

2 Likes

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