[Web3Auth] login flow failed with error type dismiss

The login flow using the web3auth.login function is failing specifically on Android devices, showing the following error message: “[Web3Auth] login flow failed with error type dismiss”. It’s worth noting that the same functionality works flawlessly on iOS, and the ID token obtained from Google also works without any problems.

I have thoroughly reviewed the documentation and explored possible reasons for this issue, including permissions, configuration settings, and any platform-specific limitations. However, I have not been able to identify the root cause.

  • Android device tested: Pixel 3a API 32 arm64 v8a
  • Android API level: 11
  • Relevant library versions:
    “react-native-google-signin/google-signin”: “^10.0.1”,
    “toruslabs/react-native-web-browser”: “^1.1.0”,
    “web3auth/react-native-sdk”: “^3.1.0”,
  • SDK Version: 3.1.0
  • Expo or Bare Version: bare
 useEffect(() => {
    GoogleSignin.configure({
      scopes: [],
      webClientId: WEB_CLIENT_ID,
      offlineAccess: true,
    });
  }, []);
 const signInWeb3Auth = async () => {
    const idToken = await signInWithGoogle();

    const clientId = 'example';

    const network = OPENLOGIN_NETWORK.CYAN;

    const web3auth = new Web3Auth(WebBrowser, {
      clientId,
      network,
    });

    const redirectUrl = "${myscheme}://openlogin";

    const state = await web3auth.login({
      loginProvider: LOGIN_PROVIDER.GOOGLE,
      redirectUrl,
      extraLoginOptions: {
        id_token: idToken,
        verifierIdField: "sub",
      },
    });

    if (state.privKey === undefined) {
      throw new Error("No private key");
    }

    return state.privKey;
  };

If there are any specific code snippets or debug logs that would be helpful, please let me know, and I will be happy to provide them.

@thomas1 Thanks for the detailed post.

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

1 Like

Seems like it works when I add a timeout between signInWithGoogle and web3auth.login

const idToken = await signInWithGoogle();

await new Promise((resolve) => setTimeout(resolve, 1500));

const state = await web3auth.login({
  loginProvider: LOGIN_PROVIDER.GOOGLE,
  redirectUrl,
  extraLoginOptions,
});

signInWithGoogle looks like this:

async function signInWithGoogle(): Promise<string> {
  try {
    await GoogleSignin.hasPlayServices();

    const userInfo = await GoogleSignin.signIn();

    const { idToken } = userInfo;

    return idToken || "error";
  } catch (error: any) {
   return 'error';
  }
}

It still doesn’t work after the fix Thomas proposed when you bundle it and submit it to the playstore. Do you guys know how to fix this?

I noticed the code implementation is a bit wrong. Since you’re directly passing the idToken, you need to create a verifier in the web3auth dashboard and use custom authentication with google here in JWT format

loginProvider: LOGIN_PROVIDER.JWT,

Check this for setting up verifier: Bring your own custom JWT Providers | Documentation | Web3Auth

The other way can be to remove extra login options all together. It will work with google login redirected from our website, app.openlogin.com.