Skip to content

Commit 528fbfa

Browse files
committed
feat(auth): add API key authentication to /token endpoint
Add apiKeyAuth middleware to /token GET endpoint for consistency with other protected endpoints. Supports both OpenAI (Authorization: Bearer) and Anthropic (x-api-key) authentication formats.
1 parent f70ac0a commit 528fbfa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/routes/token/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Hono } from "hono"
22

33
import { state } from "~/lib/state"
4+
import { apiKeyAuth } from "~/middleware/auth"
45

56
export const tokenRoute = new Hono()
67

7-
tokenRoute.get("/", (c) => {
8+
tokenRoute.get("/", apiKeyAuth, (c) => {
89
try {
910
return c.json({
1011
token: state.copilotToken,

0 commit comments

Comments
 (0)