Redirect to app not working after successful google login on android

Please provide the following details too when asking for help in this category:

  • SDK Version: 3.5.0
  • Expo or Bare Version: Bare Version
  • Screenshots of error:

Please provide the Web3Auth initialization and login code snippet below:

const login = async () => {
		try {
			setConsole("Logging in");
			const web3auth = new Web3Auth(WebBrowser, {
				clientId,
				network: OPENLOGIN_NETWORK.AQUA
			});

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

			setUserInfo(info.toString());
			setKey(info.privKey?.toString() || "");
			uiConsole("Logged In");
		} catch (e) {
			uiConsole("Error logging in", e);
		}
	};
<View style={styles.buttonArea}>
			<Button title="Login with Web3Auth" onPress={login} />
		</View>

The code above is used to log in by clicking on a login button. Everything works as expected on iOS, but on Android, when the login is successful, the button to redirect to the app does not work.

@spapinwar 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.

Hey @spapinwar

Did you add the scheme to your AndroidManifest.xml?

Also, please upgrade to v4.0.0

         <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- replace with your own scheme -->
            <data android:scheme="web3authrnbareexample" />
        </intent-filter>

Yes the scheme is added in the manifest, about v4 the documentation isn’t updated. As it needs 3 params (storage one is missing) not sure what should go there.

const info = await web3auth.login({
				loginProvider: LOGIN_PROVIDER.GOOGLE,
                               // storage,
				redirectUrl: resolvedRedirectUrl
			});

Hello @spapinwar,

Thank you for bringing this to my attention. Unfortunately, the documentation for v4 is not yet available, but it is being worked on and will be released at the beginning of next week. In the meantime, you can refer to this example repository: https://github.com/Web3Auth/web3auth-react-native-sdk/tree/master/demo/rn-bare-example and try to reproduce the same.

1 Like