Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Curious about how this compares to my current implementation #233

@dilizarov

Description

@dilizarov

I've incorporated Firebase Auth into my NestJS product. It requires firebase-admin and I include like such:

main.ts

import { NestFactory } from "@nestjs/core";
import { AppModule } from "app.module";
import * as admin from "firebase-admin";

/**
 * If there comes a time that we want to exclude "api" prefix
 * from certain controllers, then refernce this answer:
 *
 * https://github.com/nestjs/nest/issues/255#issuecomment-360749246
 *
 * Otherwise, this functionality doesn't exist atm.
 * I think it is actively being discussed/worked on though
 */
async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix("api");

  // Redacted the URL and credential for our purposes here
  admin.initializeApp({
    credential: <CREDENTIAL_CERT>,
    databaseURL: <DATEBASE_URL>
  });

  await app.listen(5000);
}
bootstrap();

Everything works fine, but then I came across this npm library.

Is there a benefit to using your method over what I did above? Is your method explicitly for baking firebase-admin into the dependency injection flow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions