diff --git a/package.json b/package.json index dc7b0fb2..8792323f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sidebase/nuxt-auth", - "version": "0.6.4", + "version": "0.6.7", "license": "MIT", "type": "module", "exports": { diff --git a/src/module.ts b/src/module.ts index 13273f09..2e222ae7 100644 --- a/src/module.ts +++ b/src/module.ts @@ -237,7 +237,7 @@ export default defineNuxtModule({ // 7.2 Add a server-plugin to refresh the token on production-startup if (selectedProvider === 'refresh') { - addPlugin(resolve('./runtime/server/plugins/refresh-token.server')) + addPlugin(resolve('./runtime/plugins/refresh-token.server')) } logger.success('`nuxt-auth` setup done') diff --git a/src/runtime/middleware/auth.ts b/src/runtime/middleware/auth.ts index d23d48b8..8e6109df 100644 --- a/src/runtime/middleware/auth.ts +++ b/src/runtime/middleware/auth.ts @@ -85,7 +85,7 @@ export default defineNuxtRouteMiddleware((to) => { } if (authConfig.provider.type === 'authjs') { - const signInOptions: Parameters[1] = { error: 'SessionRequired', callbackUrl: determineCallbackUrl(authConfig, () => to.path) } + const signInOptions: Parameters[1] = { error: 'SessionRequired', callbackUrl: determineCallbackUrl(authConfig, () => to.fullPath) } // @ts-ignore This is valid for a backend-type of `authjs`, where sign-in accepts a provider as a first argument return signIn(undefined, signInOptions) as ReturnType } else if (typeof metaAuth === 'object' && metaAuth.navigateUnauthenticatedTo) { diff --git a/src/runtime/server/plugins/refresh-token.server.ts b/src/runtime/plugins/refresh-token.server.ts similarity index 95% rename from src/runtime/server/plugins/refresh-token.server.ts rename to src/runtime/plugins/refresh-token.server.ts index c7d90ec1..51490231 100644 --- a/src/runtime/server/plugins/refresh-token.server.ts +++ b/src/runtime/plugins/refresh-token.server.ts @@ -1,5 +1,5 @@ -import { _fetch } from '../../utils/fetch' -import { jsonPointerGet, useTypedBackendConfig } from '../../helpers' +import { _fetch } from '../utils/fetch' +import { jsonPointerGet, useTypedBackendConfig } from '../helpers' import { defineNuxtPlugin, useAuthState, useRuntimeConfig } from '#imports' export default defineNuxtPlugin({ name: 'refresh-token-plugin',