Skip to content

Struggling to implement many settings/customisations #1046

@chrisnicholson

Description

@chrisnicholson

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: true locally, 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 with navigateUnauthenticatedTo, 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: false locally, unauthenticated access allowed — expected
  • setting auth: {{object}} locally with navigateUnauthenticatedTo, 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.

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement that needs to be added

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions