React native google sign in stuck on white loading screen

Viewed 1001

I am trying to use @react-native-google-signin/google-signin to login on react-native but after clicking to login button and selecting my account (on an real android device), the following blank loading screen opens and nothing else happens. This is how I am trying to achieve the login.

const SignupContainer = ({ navigation }) => {

 useEffect(async () => {
    GoogleSignin.configure({
      webClientId:
        '<webClientId>',
      offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER
      forceCodeForRefreshToken: true, // [Android] related to `serverAuthCode`, read the docs link below *.
      iosClientId:
        'iosClientId',
    })
    await isSignedIn()
  }, [])

 const signInWithGoogle = async () => {
    try {
      console.log('hello 1')
      await GoogleSignin.hasPlayServices()
      console.log('hello 2')
      const { user } = await GoogleSignin.signIn()
      console.log('hello 3')
      console.log({user: user})
      loginWithGoogle({ user })
    } catch (error) {
      if (error.code === statusCodes.SIGN_IN_CANCELLED) {
        console.log('User Cancelled the Login Flow')
      } else if (error.code === statusCodes.IN_PROGRESS) {
        console.log('Signing In')
      } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
        console.log('Play Services Not Available or Outdated')
      } else {
        console.log('Some Other Error Happened')
      }
    }
  }
}

Hello 1 and Hello 2 get logged but Hello 3 is never reached.

This is the screen I get stuck on enter image description here

0 Answers
Related