diff --git a/src/runtime/composables/local/useAuthState.ts b/src/runtime/composables/local/useAuthState.ts index 18e4ddb7..1a9fa375 100644 --- a/src/runtime/composables/local/useAuthState.ts +++ b/src/runtime/composables/local/useAuthState.ts @@ -19,7 +19,7 @@ export const useAuthState = (): UseAuthStateReturn => { const commonAuthState = makeCommonAuthState() // Re-construct state from cookie, also setup a cross-component sync via a useState hack, see https://github.com/nuxt/nuxt/issues/13020#issuecomment-1397282717 - const _rawTokenCookie = useCookie(config.token.name, { default: () => null, maxAge: config.token.maxAgeInSeconds, sameSite: config.token.sameSiteAttribute, secure: config.token.secure, domain: config.token.domain }) + const _rawTokenCookie = useCookie(config.token.name, { default: config.token.default, maxAge: config.token.maxAgeInSeconds, sameSite: config.token.sameSiteAttribute, secure: config.token.secure, domain: config.token.domain }) const rawToken = useState('auth:raw-token', () => _rawTokenCookie.value) watch(rawToken, () => { _rawTokenCookie.value = rawToken.value }) diff --git a/src/runtime/types.ts b/src/runtime/types.ts index 0156fc85..899c5288 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -125,6 +125,8 @@ type ProviderLocal = { * @default auth:token Access the cookie `auth:token` from session */ name?: string, + + default?: () => string | null /** * How to extract the authentication-token from the sign-in response. * @@ -179,7 +181,7 @@ type ProviderLocal = { * @default undefined use * @example 'domain.com' */ - domain?: boolean, + domain?: string, }, /**