Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Fix get token recursion issue on TokenStorage for expired tokens #109

Closed
wants to merge 5 commits into from

Conversation

meslater1030
Copy link

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 calls super.delete(tokenKey) which lives on the parent Storage class. The Storage class delete method calls this.get(tokenKey). Since this 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.

@msftclas
Copy link

msftclas commented Sep 15, 2018

CLA assistant check
All CLA requirements met.

@meslater1030
Copy link
Author

@sumurthy or @Zlatkovsky can I get a review on this?

@Andruha4u
Copy link

Andruha4u commented Nov 8, 2018

Hello, currently using this one and will appreciate merge it to master, thank you ahead. @meslater1030 @sumurthy @Zlatkovsky

@super2ni
Copy link

super2ni commented Feb 14, 2019

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,
Denis

@techieanalyst
Copy link

I'm also having issue which has an error saying:

unable to delete 'Microsoft' from storage

When will this fix be merged into master?

@Zlatkovsky
Copy link
Member

Adding @LouMM , @sumurthy as the maintainers of this repo.

@tomaszzmuda
Copy link

It would be nice if this will work soon :)

@Mathyaku
Copy link

Mathyaku commented Oct 30, 2019

I'm still having this problem. has Anyone a solution for that ?

@meslater1030
Copy link
Author

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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants