A simple React hook for using Google Signin on React and React Native.
Setting up Google Signin can be a pain. This simple hook aims to simplify the setup and usage so you can sign-in with Google and access Google API's in a simple way on multiple platforms.
It also makes the API's consistent between React and React Native to more easily share code.
Built on:
- "react": ">=16",
- "react-native": ">=0.59",
- "react-native-google-signin": ">=2.1"
npm install @rahsheen/google-signin
For react-native, you will (for now) also need to install react-native-google-signin
React JS example
const { userInfo, error, signIn, signOut, loading } = useGoogleSignIn(config);
React Native example
const {userInfo, error, signIn, signOut, loading, tokens} = useGoogleSignIn(
config,
GoogleSignin, // From react-native-google-signin
);
Yes, please!
This project is licensed under the MIT License - see the LICENSE file for details