-
Notifications
You must be signed in to change notification settings - Fork 925
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
feat: improve token handling and validation #690
Conversation
Initialize Token and Refresh Token instances inside schemes. Both classes now use scheme options instead of `$auth`. Also move token and refresh token prefixes to scheme `DEFAULTS`. Improve `check` method to also check tokens status, deprecating `_checkStatus`. Accept callbacks for token and refresh token expired status. Use types `AxiosRequestConfig` and `AxiosResponse` instead of `HTTPRequest` and `HTTPResponse`. RequestHandler class now use scheme options and methods instead of `$auth`.
Nice work |
Thanks 😄 |
# Conflicts: # src/inc/request-handler.ts
Have you defined the date of the V5 release ? |
Not yet. We want to make more improvements and refactors before release v5 :) |
You should maybe add a todo list to the README of the project, in this way interested developers could make their contribution 😝 I would be interested myself 🙃 |
Actually we have a board, but we need to add some more things to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff 💚
constructor (auth: Auth) { | ||
this.$auth = auth | ||
constructor (scheme: Scheme, storage: Storage) { | ||
this.scheme = scheme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However we call scheme instance strategy, i like your idea for simplification. Maybe can always call it scheme 👍
# Conflicts: # src/inc/request-handler.ts # src/schemes/local.ts # src/schemes/oauth2.ts # src/schemes/refresh.ts
Improve `check` to return object with token and refresh token expired status instead of accepting callbacks. Object structure: ``` { valid: boolean, tokenExpired: boolean, refreshTokenExpired: boolean, isRefreshable: boolean } ``` `valid` is the only required property.
# Conflicts: # src/schemes/refresh.ts
Alias `HTTPRequest` to `AxiosRequestConfig` and `HTTPResponse` to `AxiosResponse`
Initialize Token and Refresh Token instances inside schemes. Both classes now use scheme options instead of
$auth
. Also move token and refresh token prefixes to schemeDEFAULTS
.Improve
check
method to also check tokens status, deprecating_checkStatus
. Return object with token and refresh token expired status.Note:
valid
is the only required property.Alias
HTTPRequest
toAxiosRequestConfig
andHTTPResponse
toAxiosResponse
.RequestHandler class now use scheme options and methods instead of
$auth
.