We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0eea47a commit cf32ea7Copy full SHA for cf32ea7
src/runtime/middleware/auth.ts
@@ -85,6 +85,10 @@ export default defineNuxtRouteMiddleware((to) => {
85
}
86
87
if (authConfig.provider.type === 'authjs') {
88
+ // If the middleware runs on a pre-render of the route, do not call signIn, as this is a client method
89
+ if (process.server) {
90
+ return
91
+ }
92
const signInOptions: Parameters<typeof signIn>[1] = { error: 'SessionRequired', callbackUrl: determineCallbackUrl(authConfig, () => to.path) }
93
// @ts-ignore This is valid for a backend-type of `authjs`, where sign-in accepts a provider as a first argument
94
return signIn(undefined, signInOptions) as ReturnType<typeof navigateToAuthPages>
0 commit comments