# react-google-login-button

> Renders the Google Login button that will trigger Google's OAuth2 process. Highly customizable as per Google's documentation.

Latest version **1.0.2** (published 2018-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-google-login-button
pnpm add react-google-login-button
yarn add react-google-login-button
bun add react-google-login-button
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-03-30 |
| First published | 2018-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 194.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lars Tijhuis |
| Maintainers | ljtijhuis |
| Keywords | React, Google, OAuth2, Login, Button |

## Links

- npm: https://www.npmjs.com/package/react-google-login-button
- Repository: https://github.com/ljtijhuis/react-google-login-button
- Homepage: https://github.com/ljtijhuis/react-google-login-button#readme
- Issues: https://github.com/ljtijhuis/react-google-login-button/issues
- npm.io page: https://npm.io/package/react-google-login-button

## 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.2 (latest) — 2018-03-30
- 1.0.1 — 2018-03-30
- 1.0.0 — 2018-03-30

## README

# React Google Login Button

This component renders the Google Login button as per the [Google docs](https://developers.google.com/identity/sign-in/web/sign-in). Only difference is it is adapted for use in a React component.

Check out [the Demo!](https://ljtijhuis.github.io/react-google-login-button/).

## Parameters

| Key | Required / optional | Type | Default |
|-----|---------------------|------|---------|
| googleClientId | required | string | - |
| onLoginSuccess | required | function | - |
| onLoginFailure | required | function | - |
| width | optional | number | 140 |
| height  | optional | number | 40 |
| longTitle | optional | boolean | false |
| theme | optional | string: 'light' / 'dark' | light |

## Usage

Snippet:
```javascript
import GoogleLoginButton from 'react-google-login-button'

[...]

  render() {
    return (
      <GoogleLoginButton
        googleClientId='YOUR_GOOGLE_CLIENT_ID_HERE'
        onLoginSuccess={(googleUser) => {
          console.log('Replace this function to start using this information');
          console.log('Google User:', googleUser.getBasicProfile());
          console.log('ID token:', googleUser.getAuthResponse().id_token);
        })}
        onLoginFailure={() => console.log('Login failed')}
        width={140}
        height={40}
        longTitle={false}
        theme="light"
      />    
    );
  }
  
[...]
```

## References

  * [Gapi reference](https://developers.google.com/identity/sign-in/web/reference)
  * [Button rendering params reference](https://developers.google.com/identity/sign-in/web/reference#gapisignin2renderid-options)
  * [Use the ID token for authentication on your backend](https://developers.google.com/identity/sign-in/web/backend-auth)

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