npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vmutafov/firebase-auth-node-persistence

v0.1.1

Published

Configurable file-based Firebase Authentication NodeJS persistence

Downloads

197

Readme

Firebase Auth NodeJS Persistence

npm version

What?

This library is a simple file-based Firebase Auth NodeJS persistence provider. The idea behind it is that at the time of writing, Firebase's client SDK does not have persistent authentication storage when running in NodeJS - it only has an in-memory one. This is quite different from its usage in the browser where the Local Storage, Session Storage, or IndexedDB could be used.

Why?

There are use cases where having persistent authentication may be necessary for NodeJS applications:

  • having a CLI application where you want users to log in via dedicated command and not to be prompted on every next command to log in, e.g. the Firebase CLI where you log in once and you are not required to log in on each command
  • transferring your authenticated user to another machine or another NodeJS process

How?

Using the library is rather simple, you only need to initialize the Firebase Auth explicitly setting the persistence:

import { getApp } from "firebase/app";
import { initializeAuth } from "firebase/auth";
import { createNodeFilePersistence } from "@vmutafov/firebase-auth-node-persistence";
import { resolve } from "node:path";
import { cwd } from "node:process";

const app = getApp();

const nodeFilePersistence = createNodeFilePersistence({
    filePath: resolve(cwd(), '.appwrapsrc')
});

const auth = initializeAuth(app, {
    persistence: [nodeFilePersistence]
});

Setting the filePath property of the configuration options for the createNodeFilePersistence function allows you to specify a file that would be used for storing the authentication data.