north-star / files / src / platform / firebase.ts
firebase.ts
4e701dc7 2026-03-16 Pavel Safronov | 1 | import { initializeApp } from 'firebase/app'; |
| 2 | import { getAuth, signInAnonymously } from 'firebase/auth'; | |
| 3 | import { getDatabase } from 'firebase/database'; | |
36d64b37 2026-03-15 Pavel Safronov | 4 | |
| 5 | const firebaseConfig = { | |
| 6 | apiKey: 'AIzaSyA4G7e13Gt1XAIds1Y63X_RFw-2O48iCLM', | |
| 7 | authDomain: 'north-star-e5dee.firebaseapp.com', | |
| 8 | projectId: 'north-star-e5dee', | |
| 9 | storageBucket: 'north-star-e5dee.firebasestorage.app', | |
| 10 | messagingSenderId: '999461150314', | |
| 11 | appId: '1:999461150314:web:53f3c6216dd4b0468bf413', | |
| 12 | databaseURL: 'https://north-star-e5dee-default-rtdb.firebaseio.com/' | |
| 13 | }; | |
| 14 | ||
| 15 | export const initFirebaseSession = async () => { | |
| 16 | const app = initializeApp(firebaseConfig); | |
| 17 | const auth = getAuth(app); | |
| 18 | const db = getDatabase(app); | |
| 19 | ||
| 20 | const authSignInResponse = await signInAnonymously(auth); | |
| 21 | const uid = authSignInResponse.user.uid; | |
| 22 | ||
| 23 | console.debug('Signed in anonymously:', authSignInResponse); | |
| 24 | console.debug('User ID:', uid); | |
| 25 | ||
| 26 | return { db, uid }; | |
| 27 | }; |