showing results for - "google sign in in firebase react"
Briella
21 Mar 2017
1//add to your firebase.js file: google provider sign-in
2const googleProvider = new firebase.auth.GoogleAuthProvider();
3export { firebase, db, auth, functions, googleProvider }
4
5//Actions/GoogleAuthentication.js
6import { firebase, googleProvider, db } from '../components/firebase/firebase'
7import React, {useEffect} from "react";
8import { useHistory, Redirect } from 'react-router-dom'
9
10export const SignInWithGoogle = () => {
11    const history = useHistory();
12    useEffect(() => {
13        setTimeout(() => {
14            history.push('/dashboard');
15         }, 10000);
16       },[]);
17
18    return () => {
19        return firebase.auth().signInWithPopup(googleProvider)
20        .then(async result =>{
21            console.log(result.credential.accessToken)
22            const user = result.user
23            console.log(user)
24            localStorage.setItem('userid', user.uid)
25            localStorage.setItem('photoURL', user.photoURL)
26            //TODO if userid exists IN USERS db then use update IF NULL use set
27            await db.collection('users').doc(user.uid).update({
28               // id: user.uid,
29                name: user.displayName,
30                email: user.email,
31                phone: user.phoneNumber,
32                photoURL: user.photoURL
33            })
34        })
35        .then(() => {
36            history.push('/dashboard');
37        })
38        .catch( err => {
39            console.log(err)
40        })       
41    }
42}
43
44export const startLogout = () => {
45    return () => {
46        return firebase.auth().signOut()
47    }
48}
queries leading to this page
add google login to react firebasegoogle sign in react firebaselogin using firebasefirebase react sign in with googlereact firebasui google authfirebase using signinwithredirectreact firebase google sign ingoogle auth in react firebasefirebase google sign in jsauth with google firebase reactsign in with google firebase reactreact and firebase google authenticationreact firebase signup and login with googlehow to sign up with google firebase react jsgoogle login firebase reactfirebase google sign in reactgoogle auth in firebase reactfirebase google authentication idtoken where to find reactsign in with googel firebaseregister with google firebase reactjsfirebase google authentication react jslinkedin sign in with firebase reactgoogle auth firebase reactfirebase google authentication web reactfirebase google signin in react appgoogle login with firebase reactreact native firebase google loginfirebase google login reactgoogle signin firestoregoogle signout react js and firebaseauto sign in with google firebase reactimplement google auth with firebase in reactreact firebase sign in with googlereact google login firebasegoogle sign infirebase in reactgoogle javascript firebase login apihow to login using google with firebase in reactsign in with google using firebase and reactjsimplement firebase google sign in reacfirebase signinwithgoogle popupgoogle signin in firebase reactgoogle sign in using firebase on react webappfirebase signup page reactfirebase google sign in needs refresh pagegoogle signed in firebase reactreact firebase google authenticationfirebase sign in with google react codesign in with google firebase react examplesign in with google rendering about blank firebasegoogle authentication firebase reacthow to authentication firebase google sign in with react jshow to coonect firebase signin with google with reactreact google login prevent multiple database inputsnodejs firebase signinwithgoogle authenticationsign in authorization javascript codehow to add continue with google firebase reactfirebase google signin in react and expressnode firebase google signingoogle sign in firebase flutteraccess signinwithgoogleclick error firebasereact sign in with google with firebasesign in with google react native firebasefirebase sign in with redirectfirebase auth google reactfirebase auth google sign in reactreact authentication firebase signin loginfirebase doesn 27t load gogle accounts wityh googleauthproviderfirebase google sign inhow to add sign in using google in react js from firebasesign in with google firebase react jsreact sign in with google firebasefirebase login with google in react jsgoogle sign in with popup needs refresh react firebasegoogle firebase sign inreact js google auth firebasereact google sign in firebaseimplement firebase google sign in reactfirebase login with google reactreact firebase google loginlogin with google button react firebasegoogle login with firebase reactjsfirebase google sign in needs refreshed pagefirebase login with google reacthow to add firebase google signup to react apphow to redirect a user to its own account in javascript firebase real time databsechange authorized domains firebase gmail login pagewhy signinwithpop not working on android in firebase with reactjs for webapplogin with google react js with firebasefirebase signin flowsigninwithpopup firebaselisten for google signinfirebase authentication email and password react firebase react google logingoogle login with firebase and react jsfirebase react sign in with googlegoogle sign in with popup issues react firebasefirebase react google authenticationreact sign with firebase google authflutter google signin with firebasefirebase web authentication with react and googlegoogle login with firebase in webauthenticate using google sign in react js firebasereact google authentication firebasefirst time firebase sign in with google in reactno users being show with google outh in firebasegoogle sign in react js firebasefirebase popup is user newsign in with google firebase in react appgoogle javascript sign in doesn 27t fireimplement firebase google sign in react functional componentfirebase sign up with google reactfirebase login with google account reactgoogle firebase sign out in react jsreact firebase google signingoogle sign in with firebase with reactjsgoogle authentication react firebase webfirebase google loginfirebase google login react sconnect with gmail firebasehow to sign up witj google firebase react jsauth google firebase and reactgoogle firebase signin react jssign in with google firebasefirebase web authentication with react and google and nodesignin and signup with google in firebase reactgoogle login firebase and reactfirebase function goes to google log in formreact js firebase auth googlereact js firebase auth google get userreact 2b firebase 2b google authentication latestreact firebase goole loginfirebase google sign in react nativesign up firebase react jsgoogle login authentication firebase reactreact native firebase google sign infirebase sign in with google reactfirebase create user with signinwithpopupblock google sign in firebase reacthow to javascript singinhow to use google sign in featur of firebase with reactfirebase google sign in react jsfirebase googel login reactadd sign in with google to react with firebasegoogle sign in without firebase react nativesign in with google with firebase reacthow to open a popup gogle sigin in crome when user is not logingoogle sign in firebase example reactsign in with google react js firebasefirebase google signin reacthow to connect firebase signin with google with reactsign in with google react firebasefirebase login with ggole reactfirebase google sign in react tutoriallogin with google firebase web reacthow to integrate google firebase login and registration react jssign in with google using firebase on mobile reactlogin with google firebase reactfirebase email sign inauthenticate firebase react googlefirebase login reactfirebase express react signinwithpopupauthentication with google account firebase reacthow to signin with google react firebasesigninwithpopop google auth react nativegoogle oauth in reactfirbase google loginfirebase loginbygmail redirectgoogle sign in with firebase reactfirebase goole sign in with reactgoogle signout in firebase react jsgoogle firebase login in reactgoogle sign in in firebase reactfirebase login in reacthow to implement google sign in with react and firebasefirebase google login in react jssignup with google firebase reactfirebase sign in with googlegoogle sign in reacthow to use google firebase auth in react appfirebase login with googlefirebase login google reactreact google login firebasefirebase react cant sign in with googlefirebase with react auth in google loginfirebase auth react google sign 40react firebase sign upreact native signup and login firebasereact firebase email authenticationfirebase google login react jsgoogle sign in expo react native firebasereact google sign upfirebase google sign in check if is existingfirebase authentication google sign in reactadd google login firebase reacthow to sign in with googlein react firebasegoogle login in react firebasegoogle firebase authentication reactreact firebase login with googlegoogle login with firebase and reactgoogle sign in firebase reactfirebase email login in web react jahow to authentication user with google account in react on firebasehow to login with firestore in javascriptmake google signin auth in react firebasegoogle login with firebase in reacthow to do oauth with firebase and reactreactjs login with google firebasereactjs sign in with google firebasesingup with google firebase reactjsreactjs google login with firebasegoogle sign in react js firebasefirebase login with google react jsreact firebase app with google login freact sign in withput google on firebasegoogle provider auth type typescript firebasereact js firebase gmail authfirebase google auth reactsign in with google authenticator firebase reacthow to use sign up with google react firebasefirebase google sign in with reactadding google sign in to react firebasefirebase google authentication reactgoogle sign in in firebase react