react-google-login-button

1.0.2 • Public • Published

React Google Login Button

This component renders the Google Login button as per the Google docs. Only difference is it is adapted for use in a React component.

Check out the Demo!.

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:

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    87
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    87
  • 1.0.1
    3
  • 1.0.0
    3

Package Sidebar

Install

npm i react-google-login-button

Weekly Downloads

21

Version

1.0.2

License

MIT

Unpacked Size

200 kB

Total Files

5

Last publish

Collaborators

  • ljtijhuis