We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
No response
I'm using:
auth: { provider: { type: 'authjs' }, globalAppMiddleware: true }
in nuxt.config.ts
Which means that it enables the default auth middleware:
import { navigateTo, defineNuxtRouteMiddleware, useRuntimeConfig } from "#app"; import { determineCallbackUrl } from "../utils/url.mjs"; import { useAuth } from "#imports"; export default defineNuxtRouteMiddleware((to) => { const metaAuth = typeof to.meta.auth === "object" ? { unauthenticatedOnly: true, ...to.meta.auth } : to.meta.auth; if (metaAuth === false) { return; } const authConfig = useRuntimeConfig().public.auth; const { status, signIn } = useAuth(); const isGuestMode = typeof metaAuth === "object" && metaAuth.unauthenticatedOnly; if (isGuestMode && status.value === "unauthenticated") { return; } if (typeof metaAuth === "object" && !metaAuth.unauthenticatedOnly) { return; } if (status.value === "authenticated") { if (isGuestMode) { return navigateTo(metaAuth.navigateAuthenticatedTo ?? "/"); } return; } if (authConfig.globalAppMiddleware.allow404WithoutAuth) { const matchedRoute = to.matched.length > 0; if (!matchedRoute) { return; } } if (authConfig.provider.type === "authjs") { const signInOptions = { error: "SessionRequired", callbackUrl: determineCallbackUrl(authConfig, () => to.path) }; return signIn(void 0, signInOptions); } else if (typeof metaAuth === "object" && metaAuth.navigateUnauthenticatedTo) { return navigateTo(metaAuth.navigateUnauthenticatedTo); } else { return navigateTo(authConfig.provider.pages.login); } });
But as you can see there is no "process.server" check before running "signIn" method. And as shown in documentation: https://next-auth.js.org/getting-started/client#signin
this method is client side only.
This causes this error: [nuxt] [request error] [unhandled] [500] Cannot set headers after they are sent to the client
The text was updated successfully, but these errors were encountered:
Wrong project, sorry, opened one on: sidebase/nuxt-auth#537
Sorry, something went wrong.
No branches or pull requests
Environment
No response
Reproduction
No response
Describe the bug
I'm using:
in nuxt.config.ts
Which means that it enables the default auth middleware:
But as you can see there is no "process.server" check before running "signIn" method. And as shown in documentation: https://next-auth.js.org/getting-started/client#signin
this method is client side only.
This causes this error: [nuxt] [request error] [unhandled] [500] Cannot set headers after they are sent to the client
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: