Error while integrating Firebase

Please provide the Web3Auth initialization and login code snippet below:

    final themeMap = HashMap<String, String>();
    themeMap['primary'] = "#F5820D";

    Uri redirectUrl;
    if (Platform.isAndroid) {
      redirectUrl = Uri.parse('rart://com.reasonedart.app/auth');
    } else if (Platform.isIOS) {
      redirectUrl = Uri.parse('rart://openlogin');
    } else {
      throw UnKnownException('Unknown platform');
    }

    final loginConfig = HashMap<String, LoginConfigItem>();
    loginConfig['jwt'] = LoginConfigItem(
      verifier: "firebase-mainnet-rart-verifier",
      typeOfLogin: TypeOfLogin.jwt,
      name: "RArt JWT Login",
      clientId:
          "BI1ZUiuB3YuZVpROQ0v_wqWpWE8UTw_-H0f9F0Dx2CCdpqgXGAvk02_sC8BtTruu34wZAu-66f1cKFQ-6WW2BJ8",
    );

    await Web3AuthFlutter.init(
      Web3AuthOptions(
        clientId:
            'BI1ZUiuB3YuZVpROQ0v_wqWpWE8UTw_-H0f9F0Dx2CCdpqgXGAvk02_sC8BtTruu34wZAu-66f1cKFQ-6WW2BJ8',
        network: Network.cyan,
        redirectUrl: redirectUrl,
        whiteLabel: WhiteLabelData(
          dark: true,
          name: "Monuverse",
          theme: themeMap,
        ),
        loginConfig: loginConfig,
      ),
    );
void _withGoogle() async {
    try {
      final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();

      // Obtain the auth details from the request
      final GoogleSignInAuthentication? googleAuth =
          await googleUser?.authentication;

      // Create a new credential
      final credential = GoogleAuthProvider.credential(
        accessToken: googleAuth?.accessToken,
        idToken: googleAuth?.idToken,
      );

      // Once signed in, return the UserCredential
      final firebaseCredential =
          await FirebaseAuth.instance.signInWithCredential(credential);
      String idToken =
          (await firebaseCredential.user?.getIdToken(true)).toString();
      final response = await Web3AuthFlutter.login(
        LoginParams(
          loginProvider: Provider.jwt,
          mfaLevel: MFALevel.NONE,
          extraLoginOptions: ExtraLoginOptions(
            id_token: idToken,
            domain: 'firebase',
          ),
        ),
      );
      await _saveInfo(response.privKey!, response.userInfo!);
      Navigator.pushNamed(context, "/home");
      Navigator.pushReplacementNamed(context, "/home");
    } catch (e) {
      print(e);
    }
  }

@paolo.rollo1997 Thanks for reaching out.

Your issue has been forwarded to our team and we will get back with further updates once more information becomes available.

If it may help, now the error has changed but all of this used to work when using Network.testnet:

Could not get result from torus nodes \n Error occurred while verifying paramscould not get jwt validation field https://securetoken.google.com/OMITTED from token

Any updates on this? Still getting the same error @vjgee

Hey @paolo.rollo1997

We would need a sample idToken to debug the issue. Also, could you share the console logs from this screen.

Refer to this article on how to: How to debug iOS devices?

What do you mean by sample id token? Isn’t a security issue if we share an id_token? @shahbaz

Hello - I’m experiencing a very similar issue to this (I’m integrating Firebase with web3auth) - are there any updates to this ticket? My error is similar:

Error occurred while verifying params could not get jwt validation field https://securetoken.google.com/******* from token &{[********] 0xc00be49380 0xc00be49368 0xc00cc1b620 <nil> <nil>

Hi,
I encountered the same problem as you, and it’s due to a mismatch in the JWT validation field configuration. Can you check this and ensure you’ve corrected the JWT validation field?

2 Likes

Thanks so much @toanbt - I had a bit of a brainfart and it ended up being a reference to the wrong API key from the Twitter/X development console. Once I chose the correct API key, it is now authenticating properly with Firebase and then web3auth - really appreciate your help!

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