File size: 1,045 Bytes
0a08115
e7b25b5
0a08115
 
 
fc2cf9d
0a08115
 
 
 
 
 
 
f3f8e11
 
fc2cf9d
 
f3f8e11
 
fc2cf9d
 
f3f8e11
 
 
e7b25b5
 
fc2cf9d
e7b25b5
 
0a08115
fc2cf9d
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { initializeApp } from "firebase/app";
import { getAuth, GoogleAuthProvider, browserLocalPersistence, setPersistence } from "firebase/auth";

const firebaseConfig = {
  apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
  authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
  projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
  storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
  messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
  appId: import.meta.env.VITE_FIREBASE_APP_ID
};

// Initialize Firebase
let app;
try {
  if (firebaseConfig.apiKey) {
    app = initializeApp(firebaseConfig);
  }
} catch (error) {
  // Silent fail or minimal log for production
  console.error("Firebase Init Failed");
}

export const auth = app ? getAuth(app) : null;

if (auth) {
  setPersistence(auth, browserLocalPersistence).catch(() => {});
}

export const googleProvider = new GoogleAuthProvider();
// Force account selection every time for clarity
googleProvider.setCustomParameters({
  prompt: 'select_account'
});