title: How to setup Google Sign In for React Native App without Firebase?
body: <p>I need to add google sign-in method to my react native app. I used &quot;react-native-google-signin&quot; package. And I make a project in google console also. But I am getting an error when I try to sign in. It gives an error &quot;Some Other Error Happened&quot;, and it is in my &quot;_signIn()&quot; function. Please help me to solve my problem.</p>
  <p><strong>Here what I tried</strong></p>
  <pre><code>import React from 'react';
  import {
    StyleSheet,
    Text,
    View,
    Alert,
    Image,
    ActivityIndicator,
    TouchableOpacity,
  } from 'react-native';
  import {
    GoogleSignin,
    GoogleSigninButton,
    statusCodes,
  } from 'react-native-google-signin';
  
  export default class App extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        userInfo: null,
        gettingLoginStatus: true,
      };
    }
  
    componentDidMount() {
      //initial configuration
      GoogleSignin.configure({
        //It is mandatory to call this method before attempting to call signIn()
        scopes: ['https://www.googleapis.com/auth/drive.readonly'],
        // Repleace with your webClientId generated from Firebase console
        webClientId: 'my webclient id',
      });
      //Check if user is already signed in
      this._isSignedIn();
    }
  
    _isSignedIn = async () =&gt; {
      const isSignedIn = await GoogleSignin.isSignedIn();
      if (isSignedIn) {
        alert('User is already signed in');
        //Get the User details as user is already signed in
        this._getCurrentUserInfo();
      } else {
        //alert(&quot;Please Login&quot;);
        // console.log('Please Login');
        alert('Please Login');
      }
      this.setState({ gettingLoginStatus: false });
    };
  
    _getCurrentUserInfo = async () =&gt; {
      try {
        const userInfo = await GoogleSignin.signInSilently();
        console.log('User Info --&gt; ', userInfo);
        this.setState({ userInfo: userInfo });
      } catch (error) {
        if (error.code === statusCodes.SIGN_IN_REQUIRED) {
          alert('User has not signed in yet');
          console.log('User has not signed in yet');
        } else {
          alert(&quot;Something went wrong. Unable to get user's info&quot;);
          console.log(&quot;Something went wrong. Unable to get user's info&quot;);
        }
      }
    };
  
    _signIn = async () =&gt; {
      //Prompts a modal to let the user sign in into your application.
      try {
        await GoogleSignin.hasPlayServices({
          //Check if device has Google Play Services installed.
          //Always resolves to true on iOS.
          showPlayServicesUpdateDialog: true,
        });
        const userInfo = await GoogleSignin.signIn();
        console.log('User Info --&gt; ', userInfo);
        this.setState({ userInfo: userInfo });
      } catch (error) {
        console.log('Message', error.message);
        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');
        }
      }
    };
  
    _signOut = async () =&gt; {
      //Remove user session from the device.
      try {
        await GoogleSignin.revokeAccess();
        await GoogleSignin.signOut();
        this.setState({ userInfo: null }); // Remove the user from your app's state as well
      } catch (error) {
        console.error(error);
      }
    };
  
    render() {
      //returning Loader untill we check for the already signed in user
      if (this.state.gettingLoginStatus) {
        return (
          &lt;View style={styles.container}&gt;
            &lt;ActivityIndicator size=&quot;large&quot; color=&quot;#0000ff&quot; /&gt;
          &lt;/View&gt;
        );
      } else {
        if (this.state.userInfo != null) {
          //Showing the User detail
          return (
            &lt;View style={styles.container}&gt;
              &lt;Image
                source={{ uri: this.state.userInfo.user.photo }}
                style={styles.imageStyle}
              /&gt;
              &lt;Text style={styles.text}&gt;
                Name: {this.state.userInfo.user.name}{' '}
              &lt;/Text&gt;
              &lt;Text style={styles.text}&gt;
                Email: {this.state.userInfo.user.email}
              &lt;/Text&gt;
              &lt;TouchableOpacity style={styles.button} onPress={this._signOut}&gt;
                &lt;Text&gt;Logout&lt;/Text&gt;
              &lt;/TouchableOpacity&gt;
            &lt;/View&gt;
          );
        } else {
          //For login showing the Signin button
          return (
            &lt;View style={styles.container}&gt;
              &lt;GoogleSigninButton
                style={{ width: 312, height: 48 }}
                size={GoogleSigninButton.Size.Wide}
                color={GoogleSigninButton.Color.Light}
                onPress={this._signIn}
              /&gt;
            &lt;/View&gt;
          );
        }
      }
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
    },
    imageStyle: {
      width: 200,
      height: 300,
      resizeMode: 'contain',
    },
    button: {
      alignItems: 'center',
      backgroundColor: '#DDDDDD',
      padding: 10,
      width: 300,
      marginTop: 30,
    },
  });
  </code></pre>