Open rahInoue opened 1 month ago
Hi @rahInoue
@Code-Hex Can you handle this issue?
@rahInoue Can you elaborate a little bit on your intent as I don't understand it 100%?
Given this example
import { Hono } from "hono";
import {
VerifyFirebaseAuthConfig,
VerifyFirebaseAuthEnv,
verifyFirebaseAuth,
getFirebaseToken,
} from "@hono/firebase-auth";
const config: VerifyFirebaseAuthConfig = {
projectId: "some-id",
};
const app = new Hono<{ Bindings: VerifyFirebaseAuthEnv }>();
app.use("/api/*", verifyFirebaseAuth(config));
app.use(async (c, next) => {
const idToken = getFirebaseToken(c);
console.log("idToken.:>> ", idToken?.uid);
await next();
});
app.get("/api/hello", (c) => {
const idToken = getFirebaseToken(c);
return c.json(idToken);
});
export default app;
It logs me the uid
in the middleware and returns me the uid
via the get
handler. So it looks like you can get the uid
of the token. What is missing for your use-case?
Hello!
I am using @hono/firebase-auth for verifying Firebase ID tokens. During this verification process, if I can obtain the UID in the context (for example, if the UID is stored in KV), I believe it would allow me to execute processes dependent on the UID without having to interact with the client, based solely on the authorization header.
This may not be a common practice, but if such a feature were available, it seems like it would reduce one concern for front-end tasks.