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 🙏

© 2026 – Pkg Stats / Ryan Hefner

firebase-token-helper

v0.1.4

Published

CLI + TUI tool to generate Firebase ID tokens and set custom claims — no frontend login required

Downloads

411

Readme

Firebase Token Helper

Small CLI tool to mint a Firebase custom token for a given UID (using Firebase Admin SDK) and exchange it for a Firebase ID token (auth token) via the REST API. Useful for local development, testing, or troubleshooting auth flows.

Quick facts

  • Language: Node.js
  • Intended usage: developer CLI (server-side only)
  • No remote servers — runs locally using your service account

Prerequisites

  • Node.js 18+ (or a recent Node release)
  • A Firebase service account JSON file with privileges to create custom tokens. Get it from Firebase Console -> Project Settings -> Service accounts.
  • Firebase Web API key (Project Settings -> General -> Web API Key).

Install

npm install

Usage examples

  • Use environment variables (PowerShell example):
$env:GOOGLE_APPLICATION_CREDENTIALS = 'C:\path\to\serviceAccount.json'
$env:FIREBASE_API_KEY = 'your-web-api-key'
node index.js --uid some-uid
  • Pass the service account and apiKey via flags:
node index.js --uid some-uid --serviceAccount C:\path\to\serviceAccount.json --apiKey your-web-api-key
  • Run without args and follow interactive prompts (the tool will also auto-detect a JSON service account in .firebase/ if present):
node index.js

What the tool does

  • Initializes Firebase Admin using (priority): --serviceAccount -> GOOGLE_APPLICATION_CREDENTIALS env -> auto-detect ./.firebase/*.json.
  • Creates a custom token for the provided UID.
  • Exchanges the custom token for a Firebase ID token via the Identity Toolkit REST API (requires the Web API key).
  • Prints the custom token and the exchange result (contains idToken, refreshToken, expiresIn).

Options

  • --uid — user UID to mint the custom token for. If omitted, the CLI will prompt you.
  • --serviceAccount — path to service account JSON. If omitted, the CLI will search .firebase/ and then prompt.
  • --apiKey — Firebase Web API key. If omitted the CLI will prompt.
  • --projectId — optional project id; the script will also respect FIREBASE_PROJECT_ID env var.

Example output

The CLI prints a JSON block similar to this after exchange:

{
  "idToken": "<jwt>",
  "refreshToken": "<token>",
  "expiresIn": "3600",
  "localId": "<uid>"
}

Security notes

  • Never commit your service account JSON or API keys to source control.
  • Use this tool only in trusted environments — service account JSON grants high privileges.

Troubleshooting

  • If you see errors initializing Admin, confirm the service account path is valid and the JSON contains client_email and private_key.
  • If the exchange fails, verify the apiKey is for the same Firebase project as the service account.