Setup Firebase Admin

githubfirebase.server.ts

We use the Firebase Admin SDK server-side to verify our user's login JWT token and create a session cookie. Create ./app/utils/firebase.server.ts

import * as admin from "firebase-admin";
import { initializeApp } from "firebase-admin/app";
if (admin.apps.length === 0) {
initializeApp({
credential: admin.credential.cert(
JSON.parse(process.env.FIREBASE_ADMIN_SERVICE_ACCOUNT!)
),
});
}
export { admin };
Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin
graphql-handbook