Skip to content

Commit

Permalink
fix(firebase-auth): throw HTTPException instead of reponse null
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Hex committed Oct 5, 2023
1 parent b77369e commit f0e8aa8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/firebase-auth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers'
import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers'
import type { Context, MiddlewareHandler } from 'hono'
import { HTTPException } from 'hono/http-exception'

export type VerifyFirebaseAuthEnv = {
PUBLIC_JWK_CACHE_KEY?: string | undefined
Expand Down Expand Up @@ -61,9 +62,11 @@ export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): Middle
err,
})
}
return new Response(null, {

const res = new Response('Unauthorized', {
status: 401,
})
throw new HTTPException(401, { res })
}
await next()
}
Expand Down

0 comments on commit f0e8aa8

Please sign in to comment.