Akryum / Akryum/vue-cli-plugin-apollo

Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

Đang mở
#422 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
477
Fork
109
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Through Sentry I've noticed one of my users is running into the following error:
```
Network error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
```
It seems to originate from [defaultGetAuth accessing localStorage](https://github.com/Akryum/vue-cli-plugin-apollo/blob/master/graphql-client/src/index.js#L217)

It's triggered when a user has disabled third party cookies and a site with an iframe loads a site from a different domain that uses localStorage. Lovely combination of circumstances. More info:
- https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document
- https://stackoverflow.com/questions/30481516/iframe-in-chrome-error-failed-to-read-localstorage-from-window-access-deni

localStorage access should always include some checks. For Safari in private mode you even need a try catch:
https://stackoverflow.com/questions/35607724/ios-safari-private-browsing-localstorage-and-sessionstorage-support/43670472

(I know the vue-apollo.js file also uses localStorage in `onLogin` and `onLogout`, but I'm not using those.)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.