17 lines
457 B
TypeScript
17 lines
457 B
TypeScript
import { initializeApp, getApps, cert } from 'firebase-admin/app';
|
|
import { getAuth } from 'firebase-admin/auth';
|
|
|
|
// Initialize Firebase Admin
|
|
const apps = getApps();
|
|
|
|
if (!apps.length) {
|
|
initializeApp({
|
|
credential: cert({
|
|
projectId: process.env.FIREBASE_PROJECT_ID,
|
|
clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
|
|
privateKey: process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, '\n'),
|
|
}),
|
|
});
|
|
}
|
|
|
|
export const auth = getAuth();
|