-
Notifications
You must be signed in to change notification settings - Fork 694
Library usage with disabled cookies causes "failed to read 'localStorage' from Window: Access denied" #1087
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
Comments
I'm a tad confused: the title mentions "cookies", but the question seems to be about storage causing issues? The latter would make more sense, since this library doesn't do anything with cookies as far as I know. (Though your login server will very likely use cookies for interactive flows, so I don't know if OIDC flows will work at all if you're blocking cookies.) Could you help us get a reproducible scenario? For example something like:
|
Sorry I could've used a better title for the question :) You can easily reproduce the error I mentioned like that:
I know that this behavior is browser-specific and by disabling cookies the browser does more than just that. |
Wow, interesting that disabling cookies also disables localStorage. I can imagine it breaks this library too. That's likely something the lib could be more robust against. I'm not entirely sure if there's gonna be a community member to do a PR (and also note that merging of PRs has been on hold for some time already, at the time of writing), especially since it's a very edge case, which will likely break on the STS side after you'd make this lib robust against it. (Since the Secure Token Server will also likely need cookies to function...) |
We ran into an issue using this library inside our app with one of our users who had disabled cookies for all sites inside chrome settings (chrome://settings/cookies, "Block all cookies" or add a new entry to "Sites that can never use cookies" section), which resulted in the application unable to load throwing following error:
What we tried to do is to provide
MemoryStorage
implementation for users with disabled cookies, therefore unable to accesslocalStorage
, but unfortunately even if we provided correct Storage to those users the app still won't load.I think the issue is that inside
OAuthService
constructorangular-oauth2-oidc/projects/lib/src/oauth-service.ts
Line 160 in 8d152c2
there is a check for
localStorage
existence which throws the error mentioned above. There are also some otherwindow['localStorage']
checks insideOAuthService
which would probably fail in this situation.Would you even consider this a valid scenario with the fallback to the
MemoryStorage
to let the application work?If yes maybe
localStorage
usages within the library should be wrapped in try-catch block?The text was updated successfully, but these errors were encountered: