Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@e2fyi/firebase-admin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e2fyi/firebase-admin

CLI for firebase admin sdk

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

/firebase

code style: prettier

cli for firebase-admin.

Available Features

  • Select project credential (fb-admin project)
  • List users (fb-admin users)
  • Update custom claims for user (fb-admin claims)

Installation

# npm
npm install -g @e2fyi/firebase-admin
# yarn
yarn global add @e2fyi/firebase-admin

Project credentials

The cli connects to a firebase project by loading the environment variable FIREBASE_SERVICE_ACCOUNT from .env. The .env can be automatically generate with the fb-admin project <PATH_TO_PROJECT_CRED> command.

Creating a service account and getting the project credentials

  • Navigate to the Service Accounts tab in your project's settings page.
  • Click the Generate New Private Key button at the bottom of the Firebase Admin SDK section of the Service Accounts tab.
  • Download and keep the JSON file in a secure location.

Example

# setup current project to
# `~/.firebase/firebase_service_account.json`
fb-admin project ~/.firebase/firebase_service_account.json

Additional resources:

CLI

# run cli and see help
fb-admin -h
usage: fb-admin [-h] [-v] {project,claims,users} ...

cli command to manage custom claims for firebase users.

Optional arguments:
  -h, --help            Show this help message and exit.
  -v, --version         Show program's version number and exit.

subcommands:
  {project,claims,users}
    project             Setup credential for a firebase project.
    claims              Update the custom claims of a firebase user.
    users               List firebase users.

SUBCOMMAND PROJECT

Select a project by providing the path to the service account credentials.

usage: fb-admin project [-h] cred

Positional arguments:
  cred        Path to the JSON credential for firebase project.

Optional arguments:
  -h, --help  Show this help message and exit.

Example

fb-admin project ~/.firebase/firebase_service_account.json

SUBCOMMAND CLAIMS

Update the customClaims of a user.

usage: fb-admin claims [-h] [-d DATA] [-f FLAGS] email

Positional arguments:
  email                 ptnet user email

Optional arguments:
  -h, --help            Show this help message and exit.
  -d DATA, --data DATA  Set the custom claims with the JSON string. e.g.
                        '{"admin":1}'
  -f FLAGS, --flags FLAGS
                        Set a flag in custom claims with semicolon-delimited
                        <field=value> pairs. e.g. -f admin=1;scope=all;

Examples

# equivalent to -d {"admin": 1, "scope": "all"}
fb-admin claims someone@email.com -f admin=1;scope=all;
# equivalent to -f admin=1
fb-admin claims someone@email.com -d '{"admin":1}';

SUBCOMMAND USERS

List or search users based on email.

usage: fb-admin users [-h] [-m MATCH]

Optional arguments:
  -h, --help            Show this help message and exit.
  -m MATCH, --match MATCH
                        List only users with email matching the provided
                        minimatch pattern. e.g. *@email.com

Examples

# list all users
fb-admin users
# list all users with email domain "email.com"
fb-admin users -m *@email.com;

Keywords

FAQs

Package last updated on 16 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc