GoogleSignIn crashes on button click

try {
      await GoogleSignIn.askForPlayServicesAsync();
      const { type, user } = await GoogleSignIn.signInAsync();
      Alert.alert('GOOGLE SIGN IN - type = ' + type + ',\nuser = ' + JSON.stringify(user));

      if (type === 'success') {
        Alert.alert("GOOGLE LOGIN", "SUCCESSFUL!");
        Alert.alert('GOOGLE SIGN IN SUCCESS! - type = ' + type + ',\nuser = ' + JSON.stringify(user));
      } else {
        this.setState({ isLoading: false });
        Alert.alert("GOOGLE LOGIN", "UNSUCCESSFUL!");
        return { cancelled: true };
      }
    } catch (e) {
      this.setState({ isLoading: false });
      Alert.alert('GOOGLE LOGIN Error: ', e); // this alert shows up
      return { error: true };
    }

Fixed it by changing isOfflineEnabled to false.

try {
      await GoogleSignIn.initAsync({
        isOfflineEnabled: false, // this line here
        isPromptEnabled: true,
        clientId,
      });
    } catch ({ message }) {
      // alert('GoogleSignIn.initAsync(): ' + message);
      Alert.alert('GoogleSignIn', 'Not initialized properly.');
    }

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