This content originally appeared on DEV Community and was authored by EasyCode Sardar
Open App.js and import GoogleLogin from package
import GoogleLogin from 'react-google-login';
Now just add Google Login button with Client ID
clientId="Your_own_client_ID.googleusercontent.com"
buttonText="Login with Google"
onSuccess={pass}
onFailure={fail}
cookiePolicy={'single_host_origin'}
/>
Just add two handles for onSuccess
const fail = (result) =>{
alert(result.error);
}
and for onFailure
const pass = (googleData)=>{
console.log(googleData);
}
Read more: https://easycodesardar.blogspot.com/2021/11/login-with-google-reactjs.html
This content originally appeared on DEV Community and was authored by EasyCode Sardar

EasyCode Sardar | Sciencx (2021-11-07T06:42:57+00:00) Login with google – ReactJs. Retrieved from https://www.scien.cx/2021/11/07/login-with-google-reactjs/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.