Skip to content
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

Suggestion: Define the response message for expired JWT as part of the spec #903

Closed
abkarcher opened this issue Jun 20, 2020 · 5 comments
Closed

Comments

@abkarcher
Copy link

abkarcher commented Jun 20, 2020

Hello!

The spec currently indicates that in the case of an expired JWT, the server will send the client a 401 status code. However, as this code could be the result of an expired JWT, an invalid JWT, or (hypothetically) a bug/feature on server (or proxy) infrastructure, it would be good for the server to respond with a spec-defined message that indicates that a JWT is expired.

That way, clients can reliably take the needed refresh action automatically instead of requiring user intervention (and automation is the goal!)

In our case, we are automatically refreshing when we get a JWT expired message, but there is no way for our client to be able to handle changes in the phrasing of that message (or formatting of the JSON, as we just discovered this week). We are simply looking for the substring "JWT expired" in an error item. While this logic is not ideal, it is still better than requiring user intervention, so having ACV servers send a consistent JWT expired message would make automating this process more reliable.

Thanks,
Andrew

@Kritner
Copy link
Contributor

Kritner commented Jun 22, 2020

Could probably benefit from #863.

Currently we put the expiration datetime in UTC in the returned message, and this is what you'd like to avoid?

#883 (comment) being an example expiration message.

Thoughts @celic @shaneshaffer @smuellerDD @bfussell ? I'm fine with making that change something along the lines of "JWT expired".

@abkarcher
Copy link
Author

Thanks for the links! If people wanted to keep expiration datetime, I think it could be beneficial to have it be its own JSON Object - Ideally, In my opinion, it would be ideal to have at least one JSON object to look for that will be consistently identical in the case of an expired JWT.

I do like the suggestion that was made of having error codes in the JSON itself as well - this makes it much easier for clients to handle specific scenarios from the server in a future-proof way, assuming the error codes were indicated in the spec. HTTP status codes are nice but subject to the whims of proxies or other infrastructure specifics.

@AlexThurston
Copy link

👍 to this. HTTP codes give loosely defined reasons, but internally define errors code give users of the API much more detail and flexibility in how to behave/respond.

@smuellerDD
Copy link
Contributor

smuellerDD commented Jun 22, 2020 via email

@dmchodnicki
Copy link
Collaborator

This item has been incorporated into a new Error Code Enhancement ticket and is therefore being Closed. Please refer to #1070 for future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants