Giter Club home page Giter Club logo

react-google-login-button's Introduction

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

react-google-login-button's People

Contributors

ljtijhuis avatar

Watchers

James Cloos avatar  avatar Rory Cousland avatar

react-google-login-button's Issues

Signin when button clicked only.

Hi!I am using this simple google authentication button.when i signed in from google button ,refreshed my webpage and open sign in page again i want to see "sign in" not "signed in".as it is automatically signing in and calling "onLoginSuccess" function.can u please suggest a solution.?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.