Skip to content

fix: #728 #1046

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

Merged

Conversation

jeroenheijmans
Copy link
Collaborator

Use same storage regardless of flow in sample

The "smart" way to select a different storage type in the sample
was causing issues. Sometimes the setStorage(localStorage) call
would be made just before the first time someone uses Code Flow
which after the redirect causes the app to look in sessionStorage
for the nonce (which it wont find as the initiation of Code Flow
still used the localStorage).

This fix changes it to always use the same storage type, which gives
more reliable results. (I did consider further tweaking the "smart"
way to select the right storage, but it's super hard to predict in
which order(s) users will swap between flow types in the sample).

See also: #728 (comment)

Fixes #728

Use same storage regardless of flow in sample

The "smart" way to select a different storage type in the sample
was causing issues. Sometimes the `setStorage(localStorage)` call
would be made just before the _first_ time someone uses Code Flow
which after the redirect causes the app to look in `sessionStorage`
for the nonce (which it wont find as the initiation of Code Flow
still used the localStorage).

This fix changes it to always use the same storage type, which gives
more reliable results. (I did consider further tweaking the "smart"
way to select the right storage, but it's super hard to predict in
which order(s) users will swap between flow types in the sample).

See also: manfredsteyer#728 (comment)

Fixes manfredsteyer#728
@manfredsteyer manfredsteyer merged commit 33e6452 into manfredsteyer:master Jul 16, 2021
@manfredsteyer
Copy link
Owner

Thanks!

@zakamaner
Copy link

we are targeting Angular 11 with production ready on your package version 10.0.3. But suffering in this issue and would like to see if your team can release an minor build on version 10. @manfredsteyer

@jeroenheijmans
Copy link
Collaborator Author

@zakamaner This PR merely updates the sample, not the library itself. So if you have the same issue, you should also check out your application logic.

@jeroenheijmans jeroenheijmans deleted the 728-fix-error-with-sample branch August 27, 2021 11:25
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

Successfully merging this pull request may close these issues.

Validating access_token failed, wrong state/nonce
3 participants