Skip to content
Snippets Groups Projects
Unverified Commit 1c4047f4 authored by Christian Banse's avatar Christian Banse Committed by GitHub
Browse files

Adjusting the error checking example (#270)

This PR adjusts the error checking example so that a check for an invalid signature is also included.

See discussion in #143
parent b357385d
No related branches found
Tags v5.0.0-rc.2
No related merge requests found
......@@ -164,6 +164,9 @@ func ExampleParse_errorChecking() {
fmt.Println("You look nice today")
} else if errors.Is(err, jwt.ErrTokenMalformed) {
fmt.Println("That's not even a token")
} else if errors.Is(err, jwt.ErrTokenSignatureInvalid) {
// Invalid signature
fmt.Println("Invalid signature")
} else if errors.Is(err, jwt.ErrTokenExpired) || errors.Is(err, jwt.ErrTokenNotValidYet) {
// Token is either expired or not active yet
fmt.Println("Timing is everything")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment