Login with google – ReactJs

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={pa…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Login with google – ReactJs." EasyCode Sardar | Sciencx - Sunday November 7, 2021, https://www.scien.cx/2021/11/07/login-with-google-reactjs/
HARVARD
EasyCode Sardar | Sciencx Sunday November 7, 2021 » Login with google – ReactJs., viewed ,<https://www.scien.cx/2021/11/07/login-with-google-reactjs/>
VANCOUVER
EasyCode Sardar | Sciencx - » Login with google – ReactJs. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/07/login-with-google-reactjs/
CHICAGO
" » Login with google – ReactJs." EasyCode Sardar | Sciencx - Accessed . https://www.scien.cx/2021/11/07/login-with-google-reactjs/
IEEE
" » Login with google – ReactJs." EasyCode Sardar | Sciencx [Online]. Available: https://www.scien.cx/2021/11/07/login-with-google-reactjs/. [Accessed: ]
rf:citation
» Login with google – ReactJs | EasyCode Sardar | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.