nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.93k stars 924 forks source link

[ERROR] [AUTH] DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document. #833

Closed Vignesh-cgs closed 2 years ago

Vignesh-cgs commented 4 years ago

Incognito window in Chrome: While am using the inside of an iframe. An error was shown. please help to solve,

[ERROR] [AUTH] DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

I have Changed to localStorage: false in the nuxt_config.js file, but still not fixed the issue

auth: {
    fullPathRedirect: true,
    rewriteRedirects: true,
    watchLoggedIn: true,
    resetOnError: true,
    localStorage: false,
    redirect: {
      login: '/login',
      logout: '/',
      callback: '/login',
      home: false
    },
    strategies: {
      local: {
        endpoints: {
          login: { url: 'api/login', method: 'post', propertyName: 'data.token' },
          logout: { url: '/api/logout', method: 'post' },
          user: { url: '/api/shop/getUserInfo', method: 'post', propertyName: 'data' },
        },
        tokenType: 'Bearer',
        autoFetchUser: false,
        autoLogout: true,
      },
    }
  }
bmulholland commented 3 years ago

We don't explicitly support working inside of an iframe, and I can imagine several issues and maybe even security issues that could arise from that scenario. That said, disabling localstorage should be supported. What nuxt version was this with? Is the issue present in the latest version of nuxt/auth-next?

Vignesh-cgs commented 3 years ago

I have Used these dependencies

"dependencies": {
    "@nuxtjs/auth": "^4.9.1",
    "@nuxtjs/axios": "^5.12.0",
    "@nuxtjs/bootstrap-vue": "^2.0.4",
    "@nuxtjs/proxy": "^2.0.1",
    "@stripe/stripe-js": "^1.9.0",
    "aes256": "^1.0.4",
    "axios": "^0.19.0",
    "base-64": "^0.1.0",
    "bootstrap-vue": "^2.19.0",
    "cookieparser": "^0.1.0",
    "element-ui": "^2.13.0",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.19",
    "mockjs": "^1.1.0",
    "nuxt": "^2.9.2",
    "nuxt-cookie-control": "^1.8.8",
    "nuxt-i18n": "^6.6.0",
    "qrcode": "^1.4.4",
    "utf8": "^3.0.0",
    "vee-validate": "^3.1.0",
    "vue": "^2.6.10",
    "vue-awesome-swiper": "^3.1.3",
    "vue-cookie-law": "^1.13.3",
    "vue-gallery": "^2.0.1",
    "vue-i18n": "^8.15.5",
    "vue-image-lightbox": "^6.4.0",
    "vue-image-magnifier": "^0.2.1",
    "vue-infinite-loading": "^2.4.4",
    "vue-instagram": "^2.0.1",
    "vue-lazyload": "^1.3.3",
    "vue-masonry": "^0.11.8",
    "vue-paypal-checkout": "^3.2.0",
    "vue-product-zoomer": "^3.0.0",
    "vue-slider-component": "^3.0.41",
    "vue2-animate": "^2.1.2",
    "vue2-filters": "^0.7.2",
    "vuejs-paginate": "^2.1.0",
    "vuex": "^3.1.1",
    "vuex-persistedstate": "^2.5.4"
  },

image

bmulholland commented 3 years ago

Thanks Vignesh. Is the issue present in the latest version of nuxt/auth-next?

esinner9 commented 2 years ago

@bmulholland I have a PR that should fix this... #1405

bmulholland commented 2 years ago

Fixed in https://github.com/nuxt-community/auth-module/pull/1415. Thanks again!