Invalid auth connection config. authConnectionConfig should be an array

I was using web3auth in my ios project fine, but suddenly I got the above error.
When I do “web3Auth?.login(loginParams)” I get an error related to auth connection config in web. why?

Hi Jinu Kim!

Thanks for reaching out. It looks like you’re facing an issue related to the “Plug n Play” SDK in your iOS project. Let me help you with that.

The error “Invalid auth connection config. authConnectionConfig should be an array” suggests that your configuration might require some adjustments. Please double-check your Web3Auth initialization and login code snippets to ensure that the authConnectionConfig is being set as an array.

Here’s a checklist you can consider:

  1. Make sure your authConnectionConfig parameter is indeed an array.
  2. Review any recent changes in your project’s code that could affect Web3Auth’s configuration.
  3. Check if there have been updates made to the SDK version which may need a config change. You can verify the latest version from the Web3Auth documentation.

If you could share your Web3Auth initialization and login code snippets, that would be helpful. Additionally, any screenshots of your console might provide more insights into the issue.

For more detailed guidance, you can refer to the Web3Auth Plug n Play Integration Guide.

Let me know if you need any more help!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

Hey @jinu

Can you share the login and init code snippet? Along with the version of the SDK

My code snippet looks like this

private var loginParams: W3ALoginParams!
self.loginParams = try await prepareLoginParams()
let result = try await web3Auth?.login(loginParams)

private func prepareLoginParams() async throws -> W3ALoginParams {
        let idToken = try await Auth.auth().currentUser?.getIDTokenResult(forcingRefresh: true)
        
        var dappShare: String?

        if let user = Auth.auth().currentUser {
            dappShare = keychainHelper.loadSecret(forKey: user.uid)
        }
        
        return W3ALoginParams(
            loginProvider: .JWT,
            dappShare: dappShare,
            extraLoginOptions: ExtraLoginOptions(display: nil, prompt: nil, max_age: nil, ui_locales: nil, id_token_hint: nil, id_token: idToken?.token, login_hint: nil, acr_values: nil, scope: nil, audience: nil, connection: nil, domain: nil, client_id: nil, redirect_uri: nil, leeway: nil, verifierIdField: "sub", isVerifierIdCaseSensitive: nil, additionalParams: nil),
            mfaLevel: .MANDATORY,
            curve: .SECP256K1
        )
    }

My SDK version was originally 11.0.1, and I upgraded to the latest version, 11.1.0, because I was getting errors in this version. But the problem is the same. I was originally working with 11.0.1 for more than 2 months. I recently upgraded my xcode version, and I wonder if it has something to do with this.

How are you setting the dappShare in the first place? Also, can you share the screenshot of the error?

func loginViaFirebaseEP() async -> Bool {
        do {
            debugPrint("Web3AuthAPI loginViaFirebaseEP start")
            if (web3user != nil && loggedIn) {
                debugPrint("Web3AuthAPI loginViaFirebaseEP already logged in")
            }
            else {
                let result = try await web3Auth?.login(loginParams)
                if let dappShare = result?.userInfo?.dappShare, let user = Auth.auth().currentUser {
                    if keychainHelper.saveSecret(dappShare, forKey: user.uid) {
                        debugPrint("Web3AuthAPI loginViaFirebaseEP dappshare saved to keychain")
                    }
                    else {
                        debugPrint("Web3AuthAPI loginViaFirebaseEP dappshare save failed")
                    }
                }
                await MainActor.run(body: {
                    web3user = result
                    loggedIn = true
                    do {
                        account = try EthereumAccount(keyStorage: web3user! as EthereumSingleKeyStorageProtocol )
                        self.publicAddress = account?.address.asString() ?? ""
                        debugPrint("Web3AuthAPI loginViaFirebaseEP public address \(self.publicAddress)")
                    }
                    catch {
                         return
                    }
                })
            }
            let mfaresult = try await self.web3Auth?.enableMFA(prepareLoginParams())
            debugPrint("Web3AuthAPI loginViaFirebaseEP enableMFA result", mfaresult ?? false)

            
        } catch let error {
            print("Web3AuthAPI loginViaFirebaseEP Error: ", error)
            if error.code == 8 && error.localizedDescription == "MFA already enabled." {
                return true
            }
            return false
        }
        
        return true
    }

Please do not pass the build environment as staging or testing. Keep it as the default. This will resolve the issue. Build environments are for our internal testing, which is why we have not documented them.

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