golang-jwt / jwt

Go implementation of JSON Web Tokens (JWT).
https://golang-jwt.github.io/jwt/
MIT License
6.99k stars 336 forks source link

Using jwt's native `ErrInvalidType` instead of `json.UnsupportedTypeError` #316

Closed oxisto closed 1 year ago

oxisto commented 1 year ago

Previously, when parsing claim values, we used json.UnsupportedTypeError to denote if a claim string value is not of the correct type. However, this could lead to panics if a nil value is present and the Error function of the json.UnsupportedTypeError is called, which does not check for nil types.

Instead, we just now use ErrInvalidType similar to the map claims.

Fixes #315