0.5.1 • Published 2 years ago

react-google-sociallogin-auth v0.5.1

Weekly downloads
-
License
-
Repository
bitbucket
Last release
2 years ago

Google Authentication in React

Introduction

This is a react specific library for google authentication/login/signin.

Library link : https://www.npmjs.com/package/react-google-sociallogin-auth

Install

Install dependencies

npm i react-google-sociallogin-auth

How to Use

In your component import

 import { GoogleLoginAuth } from 'react-google-sociallogin-auth';

Add component

const onLoginSuccess = (res) => {
    console.log("Login Success:", res);   // For Login success this function will invoked
  };

const onLoginFailure = (res) => {
    console.log("Login Failed:", res);   // For Login failure this function will invoked
  };

<GoogleLoginAuth
        clientId={ClientId}    // google auth clientId

        //below properties can be customize outherwise it will take default value same as mentioned here

        height={"46px"}
        width={"213.99px"}
        fontWeight={50}
        fontSize={"15px"}
        textLogin={"Continue with Google"}
        backgroundColor={"#fff"}
        color={"#rgba(0, 0, 0, .54)"}
        border={"none"}
        borderRadius={2}
        routing={false}  //optional
        redirectUrl={"http://localhost:3001"}  //google auth redirect url, optional
        onLoginSuccess={onLoginSuccess}
        onLoginFailure={onLoginFailure}

/>