-
-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Environment
- Operating System: Linux
- Node Version: v20.19.1
- Nuxt Version: 3.18.1
- CLI Version: 3.27.0
- Nitro Version: 2.12.4
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules, auth
- Runtime Modules: @sidebase/[email protected]
- Build Modules: -
Reproduction
Attempt 1 - Global Middleware = False
https://stackblitz.com/edit/nuxt-starter-bqzghtuu?file=pages%2Findex.vue
Attempt 2 - Global Middleware = True
https://stackblitz.com/edit/nuxt-starter-apizhget?file=pages%2Findex.vue
Describe the bug
I have implemented auth in a couple of ways, but appear to be struggling to get a lot of the settings/customisations working as expected per the docs.
Attempt 1 - Global Middleware = False
Authentication has been enabled but set to false globally with the intention of enabling only for specific pages. I have a number of pages implementing various configurations as described in the docs with references to the relevant text. In particular:
- setting
auth: truelocally, unauthenticated access allowed — unexpected - setting
auth: {{ object }}locally, unauthenticated access allowed — unexpected - setting
middleware: 'sidebase-auth'locally, unauthenticated access denied — expected - setting
middleware: 'sidebase-auth'locally withnavigateUnauthenticatedTo, unauthenticated access denied but incorrect redirect — unexpected
Attempt 2 - Global Middleware = True
In an effort to get things working as expect, I've also tried enabling global middleware with the intention of disabling it for pages I want publicly accessible. Similar attempts with different configurations, in particular:
- setting
auth: falselocally, unauthenticated access allowed — expected - setting
auth: {{object}}locally withnavigateUnauthenticatedTo, unauthenticated access denied but incorrect redirect — unexpected
Additional context
In each page I've included references to the code/documentation that seem to suggest a particular behaviour, along with a table of results showing the actual outcome.