@@ -3,7 +3,7 @@ import { FaGithub, FaGoogle } from 'react-icons/fa'
33import ReactModal from 'react-modal'
44import toast from 'react-simple-toasts'
55import { useAuth } from 'src/features/auth'
6- import { auth , githubProvider , googleProvider } from '../api/FirebaseConfig '
6+ import { firebaseAuth , githubAuthProvider , googleAuthProvider } from 'src/lib/firebase '
77
88type AuthModalProps = {
99 showAuth : boolean
@@ -14,17 +14,17 @@ export const AuthModal = ({ showAuth, closeModal }: AuthModalProps) => {
1414 const { closeAuthModal, initState } = useAuth ( )
1515
1616 const signIn = ( provider : AuthProvider , providerName : string ) => {
17- signInWithPopup ( auth , provider )
17+ signInWithPopup ( firebaseAuth , provider )
1818 . then ( ( result ) => {
1919 const credential = OAuthProvider . credentialFromResult ( result )
20- const accessToken = credential ?. accessToken
20+ const idToken = credential ?. idToken
2121 const email = result . user . displayName
2222 const name = result . user . displayName
2323 const imageURL = result . user . photoURL
24- if ( accessToken && name && email && imageURL ) {
24+ if ( idToken && name && email && imageURL ) {
2525 closeAuthModal ( )
2626 initState ( {
27- accessToken : accessToken ,
27+ idToken : idToken ,
2828 user : {
2929 name : name ,
3030 email : email ,
@@ -65,14 +65,16 @@ export const AuthModal = ({ showAuth, closeModal }: AuthModalProps) => {
6565 </ p >
6666 </ div >
6767 < div >
68- < button className = "extraTextWithIconBtn" onClick = { ( ) => signIn ( githubProvider , 'Github' ) } >
68+ < button
69+ className = "extraTextWithIconBtn"
70+ onClick = { ( ) => signIn ( githubAuthProvider , 'Github' ) } >
6971 < FaGithub />
7072 Sign in with Github
7173 </ button >
7274 < button
7375 className = "extraTextWithIconBtn"
7476 style = { { marginLeft : 10 } }
75- onClick = { ( ) => signIn ( googleProvider , 'Google' ) } >
77+ onClick = { ( ) => signIn ( googleAuthProvider , 'Google' ) } >
7678 < FaGoogle />
7779 Sign in with Google
7880 </ button >
0 commit comments