{"id":22261662,"url":"https://github.com/marplex/flarebase-auth","last_synced_at":"2026-02-28T23:31:09.512Z","repository":{"id":49615218,"uuid":"509547018","full_name":"Marplex/flarebase-auth","owner":"Marplex","description":"Firebase/Admin Auth Javascript Library for Cloudflare Workers","archived":false,"fork":false,"pushed_at":"2024-06-08T15:41:28.000Z","size":208,"stargazers_count":92,"open_issues_count":2,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-09T00:03:29.637Z","etag":null,"topics":["cloudflare-workers","cloudflare-workers-kv","firebase","firebase-auth","npm","typescript"],"latest_commit_sha":null,"homepage":"https://dev.to/marplex/firebase-authentication-on-cloudflare-workers-24o3","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Marplex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2022-07-01T18:02:29.000Z","updated_at":"2025-04-30T21:44:48.000Z","dependencies_parsed_at":"2024-06-21T17:51:21.150Z","dependency_job_id":"e9526da0-80bd-43f9-b458-9bafdfc60ed3","html_url":"https://github.com/Marplex/flarebase-auth","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":"0.18181818181818177","last_synced_commit":"57bc31d7c8a767e2d66c1b90cb01c2304ec12b11"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marplex%2Fflarebase-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marplex%2Fflarebase-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marplex%2Fflarebase-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marplex%2Fflarebase-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marplex","download_url":"https://codeload.github.com/Marplex/flarebase-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166502,"owners_count":21864475,"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":["cloudflare-workers","cloudflare-workers-kv","firebase","firebase-auth","npm","typescript"],"created_at":"2024-12-03T09:13:43.316Z","updated_at":"2026-02-28T23:31:09.469Z","avatar_url":"https://github.com/Marplex.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eFlarebase Auth\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n Firebase/Admin Auth Javascript Library for Cloudflare Workers\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/marplex/flarebase-auth/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/marplex/flarebase-auth\"/\u003e\u003c/a\u003e\n  \u003cimg src=\"https://github.com/marplex/flarebase-auth/actions/workflows/node_ci.yaml/badge.svg\" alt=\"GitHub CI\"/\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@marplex/flarebase-auth\"\u003e\u003cimg alt=\"NPM\" src=\"https://badge.fury.io/js/@marplex%2Fflarebase-auth.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@marplex/flarebase-auth\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/@marplex/flarebase-auth.svg\" alt=\"NPM Downloads\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Marplex\"\u003e\u003cimg alt=\"Github\" src=\"https://img.shields.io/static/v1?label=GitHub\u0026message=marplex\u0026color=005cb2\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Supported operations:\n\n- [x] createSessionCookie()\n- [x] verifySessionCookie()\n- [x] signInWithEmailAndPassword()\n- [x] signUpWithEmailAndPassword()\n- [x] changePassword()\n- [x] lookupUser()\n\n# Install\n\n```bash\nnpm i @marplex/flarebase-auth\n```\n\n# Usage\n\nFlarebase tries to use the same method names and return values as the official Firebase/Admin SDK. Sometimes, the method signature are slightly different.\n\n**Create FlarebaseAuth**\n\n```ts\nimport { FlarebaseAuth } from '@marplex/flarebase-auth';\n\nconst auth = new FlarebaseAuth({\n  apiKey: 'Firebase api key',\n  projectId: 'Firebase project id',\n  privateKey: 'Firebase private key or service account private key',\n  serviceAccountEmail: 'Firebase service account email',\n});\n```\n\n**Sign-in with email/pass**\n\n```ts\n//Sign in with username and password\nconst { token, user } = await auth.signInWithEmailAndPassword(\n  'my@email.com',\n  'supersecurepassword'\n);\n\nconst userEmail = user.email;\nconst refreshToken = token.refreshToken;\n```\n\n**Sign-up with email/pass**\n\n```ts\n//Sign up with username and password\nconst { token, user } = await auth.signUpWithEmailAndPassword(\n  'my@email.com',\n  'supersecurepassword'\n);\n\nconst userEmail = user.email;\nconst refreshToken = token.refreshToken;\n```\n\n**Create session cookies**\n\n```ts\n//Create a new session cookie from the user idToken\nconst { token, user } = await auth.signInWithEmailAndPassword(\n  'my@email.com',\n  'supersecurepassword'\n);\n\nconst sessionCookie = await auth.createSessionCookie(token.idToken);\n```\n\n**Verify session cookies**\n\n```ts\nauth\n  .verifySessionCookie(sessionCookie)\n  .then((token) =\u003e useToken(token))\n  .catch((e) =\u003e console.log('Invalid session cookie'));\n```\n\n**Cache OAuth tokens with Cloudflare KV**\n\n```ts\nimport { FlarebaseAuth, CloudflareKv } from '@marplex/flarebase-auth';\n\nconst auth = new FlarebaseAuth({\n  apiKey: 'Firebase api key',\n  projectId: 'Firebase project id',\n  privateKey: 'Firebase private key or service account private key',\n  serviceAccountEmail: 'Firebase service account email',\n  cache: new CloudflareKv(NAMESPACE),\n});\n```\n\n# Test environment\n\nIf you want to test this library, have a look at `/src/test.env.example.json`.\nCreate a new file in the same directory called `test.env.json` with the real values and\nrun the tests with `npm test`\n\n```json\n{\n  \"FIREBASE_TEST_CREDENTIALS\": {\n    \"apiKey\": \"MY FIREBASE API KEY\",\n    \"projectId\": \"FIREBASE PROJECT ID\",\n    \"privateKey\": \"FIREBASE PRIVATE KEY OR SERVICE ACCOUNT PRIVATE KEY\",\n    \"serviceAccountEmail\": \"FIREBASE SERVICE ACCOUNT EMAIL\"\n  },\n\n  \"FIREBASE_TEST_USER\": {\n    \"email\": \"test@test.com\",\n    \"password\": \"password123\"\n  }\n}\n```\n\n# To-do\n\n- [x] Add caching support (Cloudflare KV)\n- [ ] sendEmailVerification()\n- [ ] confirmEmailVerification()\n- [ ] deleteAccount()\n\n# License\n\n```xml\nCopyright (c) 2022 Marco\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarplex%2Fflarebase-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarplex%2Fflarebase-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarplex%2Fflarebase-auth/lists"}