Please include the following information in your post:
- Which SDK this is regarding: auth0-spa-js
- SDK Version: 1.22.2
- Platform Version:
- Code Snippets/Error Messages/Supporting Details/Screenshots:
nuxt-auth
has not been integrated with nuxt 3 yet (as per the overview here). However, I still want to give auth0 with nuxt3 a shot. I found this guide, which seemed promising.
However, AFAICT loading the auth0 client library into a middleware fails immediately on the iframe work in utils.ts
:
In particular, it throws:
[h3] [unhandled] H3Error: document is not defined
at createError (file:///Users/colearendt/working/dgroup.app/node_modules/h3/dist/index.mjs:191:15)
at Server.nodeHandler (file:///Users/colearendt/working/dgroup.app/node_modules/h3/dist/index.mjs:381:21) {
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: 'Internal Server Error'
}
or
[nitro] [dev] [unhandledRejection] ReferenceError: window is not defined
at e.<anonymous> (file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:108286)
at file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:1532
at Object.next (file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:1637)
at file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:574
at new Promise (<anonymous>)
at c (file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:319)
at e.__checkSession (file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:108191)
at e.install (file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4155:106335)
at Object.use (/Users/colearendt/working/dgroup.app/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:4305:28)
at file:///Users/colearendt/working/dgroup.app/.nuxt/dist/server/server.mjs:4126:20
Does anyone have recommendations on the best way to get around this?
I have noticed that the nuxt-auth module (works only w/ nuxt 2 presently) does use window.
somehow without error. But it’s not clear to me if this is a problem in configuring the client, setting up the nuxt3
process. or vite
: