This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Fix get
token recursion issue on TokenStorage for expired tokens
#109
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Check for expiration and delete in authenticate method
@sumurthy or @Zlatkovsky can I get a review on this? |
Hello, currently using this one and will appreciate merge it to master, thank you ahead. @meslater1030 @sumurthy @Zlatkovsky |
Hey there @meslater1030 , Sorry for the noobish question but I am not very confortable with Git. Seems like your PR corrects a bug I have on IE and I would like to install your PR has a NPM dependency. What is the correct npm command to do that? Thank you, |
I'm also having issue which has an error saying:
When will this fix be merged into master? |
YannickRe
reviewed
May 6, 2019
Co-Authored-By: meslater1030 <[email protected]>
It would be nice if this will work soon :) |
I'm still having this problem. has Anyone a solution for that ? |
Closing due to lack of response from maintainers. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issues #102 and #76 and it represents an alternative solution to PR #106.
When calling
get
on the TokenStorage class the method checks to see whether the token has expired. If the token has expired it callssuper.delete(tokenKey)
which lives on the parent Storage class. The Storage class delete method callsthis.get(tokenKey)
. Sincethis
in this case is the TokenStorage class we get an infinite recursion.I don't believe it's good practice to delete the expired token within the
get
method of the TokenStorage class since it's a side effect. If the token is expired then subsequent actions should be left to the caller. The authenticator appears to be the only caller of this method within the library and so I've updated that code to delete expired tokens if necessary. I'm aware this is a public method on TokenStorage and I'm open to suggestions about other possible alterations if this represents a breaking change for end users. However - it appears that the check for an expired token is the only additional functionality TokenStorage provides and since it does that in a way that fundamentally does not work I suspect this is a net gain.I've added tests for the change.
I've also updated the typings for tapable as per the recommendations here: webpack/tapable#53. A new install of this project otherwise throws errors.
Finally, my tests revealed that the reviver deserializer in the Storage class relies on an outdated REGEX matcher for ISO strings. I've updated that as well.
Thanks for your help and let me know if you have any questions.