# react-google-signin

> GoogleSignIn

Latest version **1.0.3** (published 2020-04-02) · BSD license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-google-signin
pnpm add react-google-signin
yarn add react-google-signin
bun add react-google-signin
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-04-02 |
| First published | 2017-09-25 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mahesh Kumar Kolla |
| Maintainers | maheshkkolla |
| Keywords | react, reactjs, react-component |

## Links

- npm: https://www.npmjs.com/package/react-google-signin
- Repository: https://github.com/maheshkkolla/ReactGoogleSignIn
- Homepage: https://github.com/maheshkkolla/ReactGoogleSignIn#readme
- Issues: https://github.com/maheshkkolla/ReactGoogleSignIn/issues
- npm.io page: https://npm.io/package/react-google-signin

## Dependencies (3)

- [react](https://npm.io/package/react.md) 16.13.1
- [jquery](https://npm.io/package/jquery.md) ^3.4.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ~6.26.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-04-02
- 1.0.2 — 2020-04-02
- 1.0.1 — 2017-09-26
- 1.0.0 — 2017-09-25

## README

# ReactGoogleSignIn
##### A React component that will allow you to integrate Google sign in and sign out to your app.

## How to install
``` 
    npm install react-google-signin 

```


## How to use
```
    import React from 'react';
    import GoogleSignIn from "react-google-signin";
    
    
    class Home extends React.Component { 
    
    
        onSignIn(userProfile, accessToken) {
            console.log(userProfile)
        }
        
        signOut() {
            this.googleAuth.signOut();
        }
    
        render() {
            return (
                <GoogleSignIn clientId="YOUR_CLIENT_ID"
            			  ref={g => this.googleAuth = g}
            			  onSuccess={this.onSignIn.bind(this)}
                />
                
                <button onClick={this.signOut.bind(this)}> Sign Out </button>  
            );    
        }
 
    }
```

## Props
 
 ####  clientId `required`
 type: String
 
 Create your Google API Console Project and Client ID and specify the client id as this prop.
 To create Client ID: https://developers.google.com/identity/sign-in/web/devconsole-project
 
   
 ####  onSuccess `required`
 type: Function
  
 onSuccess callback function will be called with userProfile and accessToken.
 AccessToken will be sent only when `needAccess` prop is set to true
    
    userProfile = {
      id: ID 
      name: NAME
      givenName: GIVENNAME
      familyName: FAMILYNAME
      email: EMAIL
      imageUrl: IMAGEURL      
    }
              
 #### onFailure `optional`
 type: Function
 
 onFailure callback function will be called with error object when sign in fails
   
 #### scope `optional`
 type: String, defaultValue: profile email
 
 #### needAccess `optional`
 type: Boolean defaultValue: false
 
 The value true will allow you to get the access token as a second parameter in onSuccess callback
 
 #### width `optional`
 type: number defaultValue: 240
 
 Sets the width of the sign in button
 
 #### height `optional`
 type: number defaultValue: 50
  
 Sets the height of the sign in button
 
 #### theme `optional`
 type: String defaultValue: dark
 
 Sets the theme of the signin button

---
_Source: https://npm.io/package/react-google-signin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
