Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

definePageMeta({ auth: {} }) disables auth for the page #926

Closed
mackenzie-3spread opened this issue Oct 12, 2024 · 2 comments · Fixed by #929
Closed

definePageMeta({ auth: {} }) disables auth for the page #926

mackenzie-3spread opened this issue Oct 12, 2024 · 2 comments · Fixed by #929
Labels
bug A bug that needs to be resolved p5 Urgent Issue

Comments

@mackenzie-3spread
Copy link

mackenzie-3spread commented Oct 12, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.16.0
  • Nuxt Version: 3.12.4
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • "@sidebase/nuxt-auth": "^0.8.2",

Reproduction

The following page when navigated to redirects the user to the default login page:

<script setup lang="ts">
definePageMeta({
  auth: true,
});
</script>
<template>yeet</template>

Changing the bool value of auth to an object and including navigateUnauthenticatedTo, user can now see the contents of the page and is not redirected:

<script setup lang="ts">
definePageMeta({
  auth: {
    navigateUnauthenticatedTo: "/auth/error",
  },
});
</script>
<template>yeet</template>

Describe the bug

When using the navigateUnauthenticatedTo method on a page, the user is able to view the contents of that page and is not redirected to the specified page, indicating that auth is disabled.

Additional context

No response

Logs

No response

@mackenzie-3spread mackenzie-3spread added bug A bug that needs to be resolved pending An issue waiting for triage labels Oct 12, 2024
@phoenix-ru phoenix-ru changed the title navigateUnauthenticatedTo disables auth for the page definePageMeta({ auth: {} ) disables auth for the page Oct 17, 2024
@phoenix-ru phoenix-ru changed the title definePageMeta({ auth: {} ) disables auth for the page definePageMeta({ auth: {} }) disables auth for the page Oct 17, 2024
@phoenix-ru
Copy link
Collaborator

Thank you for the report, I've been able to reproduce it simply by using

definePageMeta({
  auth: {}
})

I will provide a fix shortly

@phoenix-ru phoenix-ru added p5 Urgent Issue and removed pending An issue waiting for triage labels Oct 17, 2024
@phoenix-ru
Copy link
Collaborator

For the context @mackenzie-3spread - you are now required to provide unauthenticatedOnly option, otherwise it will default to Guest Mode (which you were incorrectly experiencing)

https://auth.sidebase.io/guide/application-side/protecting-pages#unauthenticatedonly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved p5 Urgent Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants