1.0.4 • Published 1 year ago

social-sign v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Social Sign

A Google oAUth Sign-in / Log-in Component for React

Install

npm install social-sign

How to use

import React from 'react';
import ReactDOM from 'react-dom';
import { GoogleLogin } from 'social-sign';

function App() {
  const responseGoogle = (response) => {
    console.log(response);
  };

  return (
    <GoogleLogin
      clientId='658977310896-knrl3gka66fldh83dao2rhgbblmd4un9.apps.googleusercontent.com'
      handleResponse={responseGoogle}
    />
  );
}

export default App;

GoogleLogin Props

paramsvaluedefault valuedescription
clientIdstringREQUIREDYou can create a clientID by creating a new project on Google developers website.
handleResponsefunctionREQUIREDReturn Google User Details in JWT decoded form
buttonThemeobject{ theme: 'outline'; text: 'signin_with'; shape: 'rectangular'; size: 'large'; width: '40px' }handle Button theme
promptEnablebooleanfalseGoogle One tap popup enable

handleResponse callback

handleResponse callback returns a GoogleUser object which provides access to all of the GoogleUser methods listed here: https://developers.google.com/identity/gsi/web/reference/js-reference#CredentialResponse .

You can also access the returned values via the following properties on the returned object.

property namevaluedefinition
subnumberThe unique ID of the user's Google Account
emailstringThe user's email address
email_verifiedbooleantrue, if Google has verified the email address
namestringUser Name
picturestringProfile image
given_namestringUser First Name
family_namestringUser Last Name
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago