simple-google-auth

1.0.5 • Public • Published

simple-google-auth

google auth react component

simple google auth for react

how to use

import React from 'react'
import GoogleAuth, {GoogleLogout} from 'simple-google-auth'
 
const GoogleButton = ({ onClick }) => (<button name="google" onClick={onClick}>google sign up</buttom>)
 
class LoginPage extends React.Component{
 
    googleLoginHandler =  ({ profile }) => {
          const input = {
            first_name: profile.firstName,
            last_name: profile.lastName,
            email: profile.email,
            google_id: profile.id,
          }
          console.log(input) 
      }
    
    logout = () => {
        GoogleLogout()
    }
 
    render(){
        return(
            <div>
            <GoogleAuth
              component={GoogleButton}
              onSuccess={this.googleLoginHandler}
              appId={GOOGLE_APP_ID}
            />
            <button onCLick={this.logut}>logout</buttom>
            </div>
        )
    }
}
 
 

Readme

Keywords

Package Sidebar

Install

npm i simple-google-auth

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

7.64 kB

Total Files

5

Last publish

Collaborators

  • hepiska