Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benjipott committed Nov 14, 2023
1 parent 8279898 commit 0f0a1ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ const defaultsByBackend: { [key in SupportedAuthProviders]: DeepRequired<Extract
type: 'Bearer',
headerName: 'Authorization',
maxAgeInSeconds: 30 * 60,
default: () => null,
sameSiteAttribute: 'lax',
name: 'auth:token'
name: 'auth:token',
secure: false,
domain: ''
},
sessionDataType: { id: 'string | number' }
},
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/local/useAuthState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useAuthState = (): UseAuthStateReturn => {
const commonAuthState = makeCommonAuthState<SessionData>()

// 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<string | null>(config.token.name, { default: () => null, maxAge: config.token.maxAgeInSeconds, sameSite: config.token.sameSiteAttribute, secure: config.token.secure, domain: config.token.domain })
const _rawTokenCookie = useCookie<string | null>(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 })
Expand Down
10 changes: 6 additions & 4 deletions src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,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.
*
Expand Down Expand Up @@ -149,7 +151,7 @@ type ProviderLocal = {
* @default undefined
* @example 60 * 60 * 24
*/
maxAgeInSeconds?: number | undefined,
maxAgeInSeconds?: number,
/**
* The cookie sameSite policy. See the specification here: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
*
Expand All @@ -167,11 +169,11 @@ type ProviderLocal = {
/**
* Specifies the value for the Domain Set-Cookie attribute. By default, no domain is set, and most clients will consider applying the cookie only to the current domain.
*
* @default undefined use
* @default undefined use
* @example 'domain.com'
*/
domain?: boolean,
domain?: string,

},
/**
* Define an interface for the session data object that `nuxt-auth` expects to receive from the `getSession` endpoint.
Expand Down

0 comments on commit 0f0a1ec

Please sign in to comment.