User Friendly error message when jwt token is invalid or expired#106
User Friendly error message when jwt token is invalid or expired#106
Conversation
| return | ||
| token_id = self._decode_token_id() | ||
| try: | ||
| tokens = ctx.multipass.get_tokens() # retrieve all tokens the user has generated |
There was a problem hiding this comment.
What's the performance penalty of this call?
Wouldn't this call fail in case the token used to make this request is already expired?
There was a problem hiding this comment.
Yes if this call fails, as mentioned in the PR, the same exception will be thrown (this call is inside a try except block, which on except throws the InvalidOrExpiredJWTTokenError).
This will only be called on creation of the FoundryContext, so it will only increase startup time and not decrease performance for every api request, and for me it takes around 300-500ms for this init step (which is the same time it takes for every other api call with my internet connection)
There was a problem hiding this comment.
this could theoretically be cached, so per jwt it would only need to do this request one time, and then save it into a json file, which holds all expiration times for each token id
Summary
This should fix #95
__expirationattribute.set_expirationmethod, which does the following:InvalidOrExpiredJWTTokenErrorjticlaim to an UUIDget_tokens-> if this API call fails, the exception will be thrown too, as this means the JWT Token is expired__expirationattribute will be settoken()property, now checks for the__expirationtime if it's setChecklist