golang-jwt / jwt

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

Improve ErrInvalidKeyType error messages #361

Closed Laurin-Notemann closed 10 months ago

Laurin-Notemann commented 10 months ago

This small PR adds

Generally the original error might seem obvious but for some reason it wasn't clear to me that it was specifically referring to the type in Go, I thought it was some kind of error with my jwt token and not my signing key. It seems like an easy fix of just improving the error message slightly so its clearer what is means.

Since I only looked at the example of how parse the jwt into a correct token again I was also really confused as to what "AllYourBase" even meant. Which is why I suggest to add a small comment, so its clear that this is referring to the signing key (which it only is if you read the previous examples and specifically look at the value of the signingKey).