diff --git a/deno_dist/middleware/jwt/index.ts b/deno_dist/middleware/jwt/index.ts index 490177fd6..13d5d64d7 100644 --- a/deno_dist/middleware/jwt/index.ts +++ b/deno_dist/middleware/jwt/index.ts @@ -18,7 +18,7 @@ export const jwt = (options: { cookie?: string alg?: SignatureAlgorithm }): MiddlewareHandler => { - if (!options) { + if (!options || !options.secret) { throw new Error('JWT auth middleware requires options for "secret') } diff --git a/src/middleware/jwt/index.ts b/src/middleware/jwt/index.ts index 28a082a30..b47919ddd 100644 --- a/src/middleware/jwt/index.ts +++ b/src/middleware/jwt/index.ts @@ -18,7 +18,7 @@ export const jwt = (options: { cookie?: string alg?: SignatureAlgorithm }): MiddlewareHandler => { - if (!options) { + if (!options || !options.secret) { throw new Error('JWT auth middleware requires options for "secret') }