react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.13k stars 876 forks source link

React native Android not working for google signin #1133

Closed vkanagarajan closed 1 year ago

vkanagarajan commented 1 year ago

The below code working in ios and android getting [Error: DEVELOPER_ERROR]

await GoogleSignin.hasPlayServices(); setSigninInprogress(true); const googleUserInfo = await GoogleSignin.signIn();

  setUserID(googleUserInfo.idToken);
  setSigninInprogress(false);
  let reqObj = {
    tokenId: userID,
    loginType: "google",
  };

  if (userID) {

    googleSignin(reqObj);
  } else {
    Utility.showSnackBar("Login failed");
  }
} catch (error) {

  setSigninInprogress(false);
  if (error?.code === statusCodes.SIGN_IN_CANCELLED) {
    // user cancelled the login flow
  } else if (error?.code === statusCodes.IN_PROGRESS) {
    // operation (e.g. sign in) is in progress already
  } else if (error?.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
    // play services not available or outdated
  } else {
    // some other error happened
  }
}
AliZaib-Emumba commented 1 year ago

For android, you need to paste the Web Client ID instead of Android Client ID when configuring. Can you make sure if you are doing this thing correctly ?

vonovak commented 1 year ago

Hello and thanks for asking, please see the troubleshooting instructions @vkanagarajan Thank you 🙂