-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate everything but expiration #1130
Comments
Yes, because
Please provide more details. I can't debug unless I have a reproducible test case. To do what you want, you should delay validation by calling a token, err := jwt.ParseRequest(
request,
jwt.WithValidate(false), // **THIS**
// other options....
) This will give you a un-validated (but verified) token. Then you can run validation manually: err := jwt.Validate(token, .... options....) This way |
This is how I now parse and validate. Everything seems to work for my use case but I'm a bit surprised about the following. Maybe it is the expected behavior but it might be a bug, I'll let you decide :-)
With the above code, and the request carrying an expired token, I would expect the log statement to be reached. I do get an error with the below text
But it doesn't seem to be an |
@tonsV2 I couldn't immediately find where you set the "exp" field on the JWT. Are you by any chance trying to ask this library to tell you that the COOKIE has expired? If that's the case, this library isn't going to catch that. |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Sorry for the late reply. No, this isn't about the cookie expiration. I'm surprised that with an expired token the error message does contain ""exp" not satisfied" however the actual error doesn't seem to be a |
@tonsV2 Sorry, I admit I haven't dug deep into the test code, but from the links you gave me I can't find the token contents. Can you please show me exactly what the tokens contain that should error with token expired? |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. This does not mean your issue is rejected, but rather it is done to hide it from the view of the maintains for the time being. Feel free to reopen if you have new comments |
I'm trying to parse a HTTP request which might contain an expired token. Even if the token is expired I'd still like to ensure everything else validates and parse the payload. (It's for logging users out and ensuring some cookies are deleted client side.)
I'm trying to do the following
But if the token is expired, then
token.Get("user")
results in panic. I could parse the request twice and do some hacky error handling but I was hoping there was a better way.The text was updated successfully, but these errors were encountered: