Skip to content

Commit 610f397

Browse files
authored
🔄 synced local 'content/2.nuxt-auth/' with remote 'docs/content/' (#181)
Co-authored-by: sideborg <null>
1 parent a23e507 commit 610f397

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

content/2.nuxt-auth/2.configuration/2.nuxt-config.md

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,31 @@ type ProviderLocal = {
247247
*/
248248
cookieDomain?: string;
249249
},
250-
/**
251-
* Define an interface for the session data object that `nuxt-auth` expects to receive from the `getSession` endpoint.
252-
*
253-
* @default { id: 'string | number' }
254-
* @example { id: 'string', name: 'string', email: 'string' }
255-
* @advanced_array_example { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account', subscriptions: "{ id: number, status: 'ACTIVE' | 'INACTIVE' }[]" }
250+
/*
251+
* Settings for the session-data that `nuxt-auth` receives from the `getSession` endpoint.
256252
*/
257-
sessionDataType?: SessionDataObject,
253+
session?: {
254+
/**
255+
* Define an interface for the session data object that `nuxt-auth` expects to receive from the `getSession` endpoint.
256+
*
257+
* @default { id: 'string | number' }
258+
* @example { id: 'string', name: 'string', email: 'string' }
259+
* @advanced_array_example { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account', subscriptions: "{ id: number, status: 'ACTIVE' | 'INACTIVE' }[]" }
260+
*/
261+
dataType?: SessionDataObject;
262+
/**
263+
* How to extract the session-data from the session response.
264+
*
265+
* E.g., setting this to `/data/user` and returning an object like `{ data: { user: { id:number, name: string } }, status: 'ok' }` from the `getSession` endpoint will
266+
* storing the 'User' object typed as the type created via the 'dataType' prop.
267+
*
268+
* This follows the JSON Pointer standard, see it's RFC6901 here: https://www.rfc-editor.org/rfc/rfc6901
269+
*
270+
* @default / Access the root of the session response object
271+
* @example /data/user Access the `data/user` property of the session response object
272+
*/
273+
dataResponsePointer?: string;
274+
}
258275
}
259276

260277
```
@@ -406,7 +423,7 @@ type ProviderRefresh = {
406423
* @default '/refreshToken' Access the `refreshToken` property of the sign-in response object
407424
* @example / Access the root of the sign-in response object, useful when your endpoint returns a plain, non-object string as the refreshToken
408425
*/
409-
signInResponseRefreshTokenPointer?: string
426+
signInResponseRefreshTokenPointer?: string,
410427
/**
411428
* How to do a fetch for the refresh token.
412429
*
@@ -445,14 +462,31 @@ type ProviderRefresh = {
445462
*/
446463
cookieDomain?: string;
447464
},
448-
/**
449-
* Define an interface for the session data object that `nuxt-auth` expects to receive from the `getSession` endpoint.
450-
*
451-
* @default { id: 'string | number' }
452-
* @example { id: 'string', name: 'string', email: 'string' }
453-
* @advanced_array_example { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account', subscriptions: "{ id: number, status: 'ACTIVE' | 'INACTIVE' }[]" }
465+
/*
466+
* Settings for the session-data that `nuxt-auth` receives from the `getSession` endpoint.
454467
*/
455-
sessionDataType?: SessionDataObject,
468+
session?: {
469+
/**
470+
* Define an interface for the session data object that `nuxt-auth` expects to receive from the `getSession` endpoint.
471+
*
472+
* @default { id: 'string | number' }
473+
* @example { id: 'string', name: 'string', email: 'string' }
474+
* @advanced_array_example { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account', subscriptions: "{ id: number, status: 'ACTIVE' | 'INACTIVE' }[]" }
475+
*/
476+
dataType?: SessionDataObject;
477+
/**
478+
* How to extract the session-data from the session response.
479+
*
480+
* E.g., setting this to `/data/user` and returning an object like `{ data: { user: { id:number, name: string } }, status: 'ok' }` from the `getSession` endpoint will
481+
* storing the 'User' object typed as the type created via the 'dataType' prop.
482+
*
483+
* This follows the JSON Pointer standard, see it's RFC6901 here: https://www.rfc-editor.org/rfc/rfc6901
484+
*
485+
* @default / Access the root of the session response object
486+
* @example /data/user Access the `data/user` property of the session response object
487+
*/
488+
dataResponsePointer?: string;
489+
}
456490
}
457491
```
458492
```ts [SessionConfig]
@@ -471,7 +505,7 @@ type SessionConfig = {
471505
* @default false
472506
*
473507
*/
474-
enableRefreshPeriodically: number | boolean
508+
enableRefreshPeriodically: number | boolean,
475509
/**
476510
* Whether to refresh the session every time the browser window is refocused.
477511
*

content/2.nuxt-auth/3.application-side/2.session-access-and-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ inferface SessionData {
186186
id: string | number
187187
}
188188

189-
// Option B: You configured `auth.provider.sessionDataType` to something like ` { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account' }`
189+
// Option B: You configured `auth.provider.session.dataType` to something like ` { id: 'string', email: 'string', name: 'string', role: 'admin | guest | account' }`
190190
inferface SessionData {
191191
id: string
192192
email: string
@@ -196,7 +196,7 @@ inferface SessionData {
196196
```
197197
::
198198

199-
### About `auth.provider.sessionDataType`
199+
### About `auth.provider.session.dataType`
200200

201201
This is a configuration option available to dynamically type the `SessionData` that the `local` provider will return when accessing `data.value`. Read more about this in the [nuxt.config.ts configuration documentation](/nuxt-auth/v0.6/configuration/nuxt-config) of the `local` provider.
202202

0 commit comments

Comments
 (0)