1.0.1 • Published 2 years ago

@microbackend/plugin-firebase v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@microbackend/plugin-firebase

Microbackend plugin to add support for firebase.

Installation

npx microbackend plugin add @microbackend/plugin-firebase

Usage

import createPluginConfig from "@microbackend/plugin-core/build/webpack.build";

await createPluginConfig({
  pluginOptions: {
    "@microbackend/plugin-firebase": {
      serviceAccountEnvVariable: "CUSTOM_GOOGLE_SERVICE_ACCOUNT",
      serviceAccountPath: path.resolve(
        "credential",
        "google_service_account.json"
      ),
    },
  },
});

If not provided, serviceAccountEnvVariable defaults to GOOGLE_SERVICE_ACCOUNT_CREDENTIALS.

The above configuration does the following steps:

  • Read the service account file specified by serviceAccountPath.
  • Store the service account credentials in the environment variable specified by serviceAccountEnvVariable, which can then be accessed during runtime like this: process.env["CUSTOM_GOOGLE_SERVICE_ACCOUNT"].

The plugin creates an extension on app to expose a firebaseAdmin property using the service account credentials.

app.use((req, res, next) => {
  const firebaseAuth = req.app.firebaseAdmin.auth();
  /** Perform auth */
  next();
});

For more information on how to use the firebase Node.js SDK, please read its documentation.

1.0.1

2 years ago

1.0.1-alpha.166

2 years ago

1.0.1-alpha.165

2 years ago

1.0.1-alpha.182

2 years ago

1.0.1-alpha.180

2 years ago

1.0.1-alpha.181

2 years ago

1.0.1-alpha.170

2 years ago

1.0.1-alpha.154

2 years ago