Skip to content

osvald0/bun-hono-firebase-auth-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

bun-hono-firebase-auth-middleware

The firebase-admin library doesn't work with Bun for that reason I created this middleware.

Here an example how to use it (Buun + Hono)

import { prettyJSON } from "hono/pretty-json";
import { cors } from "hono/cors";
import { Hono } from "hono";

import { firebaseAuthMiddleware } from "./firebaseAuth.js";

const app = new Hono();

app.get("/", (c) => c.text("Hello!"));
app.use("*", prettyJSON());
app.notFound((c) => c.json({ message: "Not Found", ok: false }, 404));

const api = new Hono();

api.use("/", cors());

api.get(
  "/auth",
  async (c, next) => {
    const auth = firebaseAuthMiddleware();
    return auth(c, next);
  },
  async (c) => {
    return c.json({ ok: "OK!" });
  }
);

app.route("/", api);

export default app;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published