@@ -27,7 +27,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
2727 // Listen to Firebase auth state changes
2828 const unsubscribe = onAuthStateChanged ( auth , async ( firebaseUser ) => {
2929 if ( firebaseUser ) {
30- console . log ( 'Auth state changed - user signed in:' , firebaseUser . uid ) ;
3130 // User is signed in, fetch their profile data
3231 try {
3332 const userData = await getUserFromFirestore ( firebaseUser . uid ) ;
@@ -44,7 +43,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
4443 setUser ( null ) ;
4544 }
4645 } else {
47- console . log ( 'Auth state changed - user signed out' ) ;
4846 // User is signed out
4947 setUser ( null ) ;
5048 }
@@ -57,8 +55,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
5755
5856 const login = async ( credential : string , provider : 'google' | 'apple' = 'google' ) : Promise < void > => {
5957 try {
60- console . log ( 'Starting login process...' ) ;
61-
6258 let authCredential ;
6359 if ( provider === 'apple' ) {
6460 // For Apple, the credential might be an authorization object
@@ -81,7 +77,6 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
8177 }
8278
8379 await signInWithCredential ( auth , authCredential ) ;
84- // Note: onAuthStateChanged will handle user data fetching and setting
8580
8681 } catch ( error ) {
8782 console . error ( 'Failed to process login:' , error ) ;
@@ -92,20 +87,16 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
9287 const logout = async ( ) => {
9388 try {
9489 await auth . signOut ( ) ;
95- // Note: onAuthStateChanged will handle clearing user state
9690
9791 // Redirect to welcome page
9892 window . location . hash = 'welcome' ;
99-
100- console . log ( 'User signed out' ) ;
10193 } catch ( error ) {
10294 console . error ( 'Error during logout:' , error ) ;
10395 }
10496 } ;
10597
10698 const updateUser = ( updatedUser : User ) => {
10799 setUser ( updatedUser ) ;
108- // User data will be refetched from Firestore on next auth state change
109100 } ;
110101
111102 const refreshUserData = useCallback ( async ( ) : Promise < void > => {
@@ -132,38 +123,17 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({children}) => {
132123
133124 const loginWithApple = async ( ) : Promise < void > => {
134125 try {
135- console . log ( 'Starting Apple login with Firebase...' ) ;
136-
137126 // Create Apple provider
138127 const appleProvider = new OAuthProvider ( 'apple.com' ) ;
139128 appleProvider . addScope ( 'name' ) ;
140129 appleProvider . addScope ( 'email' ) ;
141130
142- console . log ( 'Apple provider configured, attempting popup sign-in...' ) ;
143-
144- // Try popup sign-in with detailed error handling
145- const result = await signInWithPopup ( auth , appleProvider ) ;
146-
147- console . log ( 'Apple sign-in successful:' , result . user . uid ) ;
148-
149- // Extract credential details
150- const credential = OAuthProvider . credentialFromResult ( result ) ;
151- if ( credential ) {
152- console . log ( 'Apple credentials obtained' ) ;
153- console . log ( 'Access token available:' , ! ! credential . accessToken ) ;
154- console . log ( 'ID token available:' , ! ! credential . idToken ) ;
155- }
131+ // Sign in with popup
132+ await signInWithPopup ( auth , appleProvider ) ;
156133
157134 } catch ( error : any ) {
158135 console . error ( 'Failed to process Apple login:' , error ) ;
159136
160- // Detailed error logging
161- console . log ( 'Error code:' , error ?. code ) ;
162- console . log ( 'Error message:' , error ?. message ) ;
163- console . log ( 'Error customData:' , error ?. customData ) ;
164- console . log ( 'Full error object:' , error ) ;
165-
166- // Handle specific errors
167137 const errorCode = error . code ;
168138 const errorMessage = error . message ;
169139
0 commit comments