Skip to content

Token has invalid claims: token is expired #372

Answered by oxisto
maheshkumar2150 asked this question in Q&A
Discussion options

You must be logged in to vote

I am not 100 % sure, if I understand your problem correctly, but if you are looking for a way to differentiate between different error messages coming from the parser, you can have a look at our examples:

jwt/example_test.go

Lines 164 to 189 in 4d0edcd

// An example of parsing the error types using errors.Is.
func ExampleParse_errorChecking() {
// Token from another example. This token is expired
var tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c"
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
return []byte("AllY…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@maheshkumar2150
Comment options

@oxisto
Comment options

Answer selected by oxisto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants