koa-jwt
Advanced tools
Comparing version 3.5.1 to 3.6.0
@@ -69,2 +69,5 @@ 'use strict'; | ||
ctx.throw(401, msg, { originalError: e }); | ||
}else{ | ||
//lets downstream middlewares handle JWT exceptions | ||
ctx.state.jwtOriginalError = e; | ||
} | ||
@@ -71,0 +74,0 @@ } |
{ | ||
"name": "koa-jwt", | ||
"version": "3.5.1", | ||
"version": "3.6.0", | ||
"description": "Koa JWT authentication middleware.", | ||
@@ -43,3 +43,3 @@ "types": "types/index.d.ts", | ||
"dependencies": { | ||
"jsonwebtoken": "8.3.0", | ||
"jsonwebtoken": "8.5.1", | ||
"koa-unless": "1.0.7", | ||
@@ -46,0 +46,0 @@ "p-any": "1.1.0" |
@@ -197,3 +197,3 @@ # koa-jwt | ||
This lets downstream middleware make decisions based on whether `ctx.state.user` is set. | ||
This lets downstream middleware make decisions based on whether `ctx.state.user` is set. You can still handle errors using `ctx.state.jwtOriginalError`. | ||
@@ -231,3 +231,3 @@ If you prefer to use another ctx key for the decoded data, just pass in `key`, like so: | ||
Notifying a client of error codes (e.g token expiration) can be achieved by sending the `err.originalError.message` error code to the client. | ||
Notifying a client of error codes (e.g token expiration) can be achieved by sending the `err.originalError.message` error code to the client. If passthrough is enabled use `ctx.state.jwtOriginalError`. | ||
@@ -234,0 +234,0 @@ ```js |
@@ -22,3 +22,3 @@ // Type definitions for koa-jwt 2.x | ||
debug?: boolean; | ||
audience?: string; | ||
audience?: string | string[]; | ||
issuer?: string; | ||
@@ -31,4 +31,4 @@ algorithms?: string[]; | ||
export interface Middleware extends Koa.Middleware { | ||
unless(params?: any): any; | ||
unless(params?: { path: RegExp[] }): Koa.Middleware; | ||
} | ||
} |
795
40810
12
+ Addedjsonwebtoken@8.5.1(transitive)
+ Addedsemver@5.7.2(transitive)
- Removedjsonwebtoken@8.3.0(transitive)
Updatedjsonwebtoken@8.5.1