{"id":19488661,"url":"https://github.com/ibrado/firebase-token-verifier","last_synced_at":"2025-04-25T18:32:48.453Z","repository":{"id":55572771,"uuid":"162420800","full_name":"ibrado/firebase-token-verifier","owner":"ibrado","description":"Lightweight verification of Firebase JWT","archived":false,"fork":false,"pushed_at":"2020-12-21T11:24:47.000Z","size":4,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T20:46:47.224Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibrado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-19T10:21:57.000Z","updated_at":"2021-01-18T11:33:09.000Z","dependencies_parsed_at":"2022-08-15T03:20:57.936Z","dependency_job_id":null,"html_url":"https://github.com/ibrado/firebase-token-verifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Ffirebase-token-verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Ffirebase-token-verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Ffirebase-token-verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Ffirebase-token-verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibrado","download_url":"https://codeload.github.com/ibrado/firebase-token-verifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250872408,"owners_count":21500810,"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":[],"created_at":"2024-11-10T21:04:49.990Z","updated_at":"2025-04-25T18:32:48.149Z","avatar_url":"https://github.com/ibrado.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# firebase-token-verifier\n\nFirebase JWT verifier, implements [Verify ID tokens using a third-party JWT library](https://firebase.google.com/docs/auth/admin/verify-id-tokens). Use as a lightweight alternative to the [Firebase Admin SDK](https://www.npmjs.com/package/firebase-admin) if all you need to do is verify or validate a Firebase JWT.\n\n## Install\n\n```\nnpm install --save firebase-token-verifier\n```\n\n## Usage\n\n`firebase-token-verifier` can be used with Promises, `async`, or callbacks.\n\n`validate()` is just a wrapper around `verify()` that also checks the project ID (audience/issuer), and optionally the user ID (subject).\n\n```javascript\nconst verifier = require('firebase-token-verifier');\nconst token = 'eyJhb...';\n```\n\n### Promise\n\n#### `verify`\n\n```javascript\nverifier.verify(token)\n.then((verified) =\u003e {\n  console.log('Verified!');\n  console.log(JSON.stringify(verified, null, 2));\n})\n.catch((err) =\u003e {\n  console.log('Error!');\n  console.log(err);\n});\n```\n\n#### `validate`\n\n```javascript\n// userId is optional\n// verifier.validate(token, projectId)\nverifier.validate(token, projectId, userId)\n.then((validated) =\u003e {\n  console.log('Validated');\n  console.log(JSON.stringify(validated, null, 2));\n})\n.catch((err) =\u003e {\n  console.log('Error!');\n  console.log(err);\n})\n```\n\n### async\n\n#### `verify`\n\n```javascript\ntry {\n  let verified = await verifier.verify(token);\n  console.log('Verified!');\n  console.log(JSON.stringify(verified, null, 2));\n} catch(err) {\n  console.log('Error!');\n  console.log(err);\n}\n```\n\n#### `validate`\n\n```javascript\ntry {\n  // userId is optional\n  // verifier.validate(token, projectId)\n  let validated = await verifier.validate(token, projectId, userId);\n  console.log('Validated!');\n  console.log(JSON.stringify(validated, null, 2));\n} catch(err) {\n  console.log('Error!');\n  console.log(err);\n}\n```\n\n### callback\n\n#### `verify`\n\n```javascript\nverifier.verify(token, (err, verified) =\u003e {\n  if(err) {\n    console.log('Error!');\n    console.log(err);\n  } else {\n    console.log('Verified!');\n    console.log(JSON.stringify(verified, null, 2));\n  }\n})\n```\n\n#### `validate`\n\n```javascript\n// userId is optional\n// verifier.validate(token, projectId, callback)\nverifier.validate(token, projectId, userId, (err, validated) =\u003e {\n  if(err) {\n    console.log('Error!');\n    console.log(err);\n  } else {\n    console.log('Validated!');\n    console.log(JSON.stringify(validated, null, 2));\n  }\n})\n```\n\n## Examples\n\nPlease see `demo.sh` and `demo/*.js`.\n\n```\n$ sh demo.sh\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrado%2Ffirebase-token-verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibrado%2Ffirebase-token-verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrado%2Ffirebase-token-verifier/lists"}