fuzzyworld

north-star / main_old / files / src / platform / firebase.ts

Branch main_old · default branch · all branches

firebase.ts

952 B · history · blame

1import { initializeApp } from 'firebase/app';
2import { getAuth, signInAnonymously } from 'firebase/auth';
3import { getDatabase } from 'firebase/database';
4
5const 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
15export 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};