fix(firebase-auth): throw HTTPException instead of reponse null (#191)
* fix(firebase-auth): throw HTTPException instead of reponse null * added changesetpull/193/head
parent
b77369e6f1
commit
794f03c363
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/firebase-auth': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fixed to make HTTPException instead of reponse null
|
|
@ -1,6 +1,7 @@
|
||||||
import type { KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers'
|
import type { KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers'
|
||||||
import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers'
|
import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers'
|
||||||
import type { Context, MiddlewareHandler } from 'hono'
|
import type { Context, MiddlewareHandler } from 'hono'
|
||||||
|
import { HTTPException } from 'hono/http-exception'
|
||||||
|
|
||||||
export type VerifyFirebaseAuthEnv = {
|
export type VerifyFirebaseAuthEnv = {
|
||||||
PUBLIC_JWK_CACHE_KEY?: string | undefined
|
PUBLIC_JWK_CACHE_KEY?: string | undefined
|
||||||
|
@ -61,9 +62,11 @@ export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): Middle
|
||||||
err,
|
err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return new Response(null, {
|
|
||||||
|
const res = new Response('Unauthorized', {
|
||||||
status: 401,
|
status: 401,
|
||||||
})
|
})
|
||||||
|
throw new HTTPException(401, { res })
|
||||||
}
|
}
|
||||||
await next()
|
await next()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue