{"id":20535709,"url":"https://github.com/e2fyi/firebase-admin","last_synced_at":"2025-04-14T07:12:53.310Z","repository":{"id":42387336,"uuid":"129703435","full_name":"e2fyi/firebase-admin","owner":"e2fyi","description":"cli for firebase admin sdk to set CustomClaims","archived":false,"fork":false,"pushed_at":"2025-03-25T03:27:19.000Z","size":1090,"stargazers_count":3,"open_issues_count":29,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T04:25:21.040Z","etag":null,"topics":["cli","custom-claims","firebase","firebase-admin-sdk"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e2fyi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-16T07:35:13.000Z","updated_at":"2019-11-24T16:22:10.000Z","dependencies_parsed_at":"2024-04-16T00:35:37.774Z","dependency_job_id":"83920a32-71fe-45ad-9482-a3456f4e281e","html_url":"https://github.com/e2fyi/firebase-admin","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"907df7b2045739fc33dcd6622155e12548a9d2a1"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2fyi%2Ffirebase-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2fyi%2Ffirebase-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2fyi%2Ffirebase-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2fyi%2Ffirebase-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e2fyi","download_url":"https://codeload.github.com/e2fyi/firebase-admin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837289,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","custom-claims","firebase","firebase-admin-sdk"],"created_at":"2024-11-16T00:33:37.100Z","updated_at":"2025-04-14T07:12:53.287Z","avatar_url":"https://github.com/e2fyi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"/firebase\n===\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![dependencies Status](https://david-dm.org/e2fyi/firebase-admin/status.svg)](https://david-dm.org/e2fyi/firebase-admin)\n[![Known Vulnerabilities](https://snyk.io/test/github/e2fyi/firebase-admin/badge.svg)](https://snyk.io/test/github/e2fyi/firebase-admin)\n\n`cli` for [firebase-admin](https://www.npmjs.com/package/firebase-admin).\n\n**Available Features**  \n- Select project credential (`fb-admin project`)\n- List users (`fb-admin users`)\n- Update custom claims for user (`fb-admin claims`)\n\n## Installation\n```bash\n# npm\nnpm install -g @e2fyi/firebase-admin\n# yarn\nyarn global add @e2fyi/firebase-admin\n```\n\n## Project credentials\nThe `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 \u003cPATH_TO_PROJECT_CRED\u003e` command.\n\n**Creating a service account and getting the project credentials**\n- Navigate to the `Service Accounts tab` in your project's settings page.\n- Click the `Generate New Private Key` button at the bottom of the Firebase Admin SDK section of the Service Accounts tab.\n- Download and keep the JSON file in a secure location.\n\nExample\n```bash\n# setup current project to\n# `~/.firebase/firebase_service_account.json`\nfb-admin project ~/.firebase/firebase_service_account.json\n```\n\nAdditional resources:\n- https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app\n\n## CLI\n```bash\n# run cli and see help\nfb-admin -h\n```\n```\nusage: fb-admin [-h] [-v] {project,claims,users} ...\n\ncli command to manage custom claims for firebase users.\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -v, --version         Show program's version number and exit.\n\nsubcommands:\n  {project,claims,users}\n    project             Setup credential for a firebase project.\n    claims              Update the custom claims of a firebase user.\n    users               List firebase users.\n```\n\n###  SUBCOMMAND `PROJECT`\nSelect a project by providing the path to the service account credentials.\n```\nusage: fb-admin project [-h] cred\n\nPositional arguments:\n  cred        Path to the JSON credential for firebase project.\n\nOptional arguments:\n  -h, --help  Show this help message and exit.\n```\nExample\n```bash\nfb-admin project ~/.firebase/firebase_service_account.json\n```\n\n### SUBCOMMAND `CLAIMS`\nUpdate the [customClaims](https://firebase.google.com/docs/auth/admin/custom-claims) of a user.\n```\nusage: fb-admin claims [-h] [-d DATA] [-f FLAGS] email\n\nPositional arguments:\n  email                 ptnet user email\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -d DATA, --data DATA  Set the custom claims with the JSON string. e.g.\n                        '{\"admin\":1}'\n  -f FLAGS, --flags FLAGS\n                        Set a flag in custom claims with semicolon-delimited\n                        \u003cfield=value\u003e pairs. e.g. -f admin=1;scope=all;\n```\nExamples\n```bash\n# equivalent to -d {\"admin\": 1, \"scope\": \"all\"}\nfb-admin claims someone@email.com -f admin=1;scope=all;\n```\n```bash\n# equivalent to -f admin=1\nfb-admin claims someone@email.com -d '{\"admin\":1}';\n```\n\n\n### SUBCOMMAND `USERS`\nList or search users based on email.\n```\nusage: fb-admin users [-h] [-m MATCH]\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -m MATCH, --match MATCH\n                        List only users with email matching the provided\n                        minimatch pattern. e.g. *@email.com\n```\nExamples\n```bash\n# list all users\nfb-admin users\n```\n```bash\n# list all users with email domain \"email.com\"\nfb-admin users -m *@email.com;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2fyi%2Ffirebase-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe2fyi%2Ffirebase-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2fyi%2Ffirebase-admin/lists"}