Skip to content

Hooks for signing in with Google on React and React Native

License

Notifications You must be signed in to change notification settings

rahsheen/google-signin

Repository files navigation

@rahsheen/google-signin

A simple React hook for using Google Signin on React and React Native.

Why You Need This

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.

Prerequisites

Built on:

  • "react": ">=16",
  • "react-native": ">=0.59",
  • "react-native-google-signin": ">=2.1"

Installing

npm install @rahsheen/google-signin

For react-native, you will (for now) also need to install react-native-google-signin

Usage

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
  );

Built With

Contributing

Yes, please!

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments