Hi,
I've noticed that the plugin src/runtime/app/plugins/session.client.ts breaks during mounting, when localStorage is not available, for instance, when the user block cookies (which seems to forbid the use of localStorage too).
In that case, I have a blank page, with the following error:
nuxt] error caught during app initialization SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
When I remove this block, the error does not occur anymore:
if (localStorage.getItem('temp-nuxt-auth-utils-popup')) {
// There is a local storage item. That's mean we are coming back in the popup
localStorage.removeItem('temp-nuxt-auth-utils-popup')
const error = useError()
if (!error.value) window.close()
}
Could it be possible to check localStorage availability before using it? With either a simple try/catch or the MDN suggested approach?
I know cookies are mandatory for the auth flow to work properly, but I think we should have a chance to display a meaningful error message or error page, instead of breaking the app.
Here are the calls to localStorage.
Thanks!
Hi,
I've noticed that the plugin src/runtime/app/plugins/session.client.ts breaks during mounting, when localStorage is not available, for instance, when the user block cookies (which seems to forbid the use of localStorage too).
In that case, I have a blank page, with the following error:
When I remove this block, the error does not occur anymore:
Could it be possible to check localStorage availability before using it? With either a simple try/catch or the MDN suggested approach?
I know cookies are mandatory for the auth flow to work properly, but I think we should have a chance to display a meaningful error message or error page, instead of breaking the app.
Here are the calls to localStorage.
Thanks!