Skip to content

Commit

Permalink
Merge branch 'main' into vi/align-react-vue-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
victoriaxyz committed Dec 19, 2024
2 parents 87d4aa7 + d43786b commit 43e0ef9
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 12 deletions.
10 changes: 4 additions & 6 deletions docs/backend-requests/making/custom-session-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ This guide will show you how to customize a session token to include additional

## Use the custom claims in your application

The [`Auth`](/docs/references/nextjs/auth-object) object in the `@clerk/nextjs` package includes a `sessionClaims` property that contains the custom claims you added to your session token.
The [`Auth`](/docs/references/nextjs/auth-object) object includes a `sessionClaims` property that contains the custom claims you added to your session token. It's returned by the [`useAuth()`](/docs/references/react/use-auth) hook, the [`auth()`](/docs/references/nextjs/auth) and `getAuth()` helpers, and the `request` object in server contexts.

Access the custom claims in your application by calling `auth()` in App Router applications or `getAuth(req)` in Pages Router applications.

The following example demonstrates how to access the `fullName` and `primaryEmail` claims that were added to the session token in the last step.
The following example demonstrates how to access the `fullName` and `primaryEmail` claims that were added to the session token in the last step. This examples are written for Next.js, but they can be adapted to other frameworks by using the appropriate method for accessing the `Auth` object.

<CodeBlockTabs options={["App Router", "Pages Router"]}>
```tsx {{ filename: 'app/page.tsx' }}
```tsx {{ filename: 'app/api/example/route.tsx' }}
import { auth } from '@clerk/nextjs/server'
import { NextResponse } from 'next/server'

export default async function Page() {
export async function GET() {
const { sessionClaims } = await auth()

const fullName = sessionClaims?.fullName
Expand Down
7 changes: 7 additions & 0 deletions docs/references/backend/types/backend-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ The Backend `User` object is similar to the `User` object as it holds informatio
- `number`

An integer indicating the number of organizations that can be created by the user. If the value is `0`, then the user can create unlimited organizations. Default is `null`.

---

- `legalAcceptedAt?`
- `number | null`

The unix timestamp of when the user accepted the legal requirements. `null` if [**Require express consent to legal documents**](/docs/authentication/configuration/legal-compliance) is not enabled.
</Properties>

[web3-ref]: /docs/references/javascript/web3-wallet/web3-wallet
Expand Down
17 changes: 16 additions & 1 deletion docs/references/backend/user/create-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ function createUser(params: CreateUserParams): Promise<User>

---

- `legalAcceptedAt?`
- `Date`

The date when the user accepted the legal documents. `null` if [**Require express consent to legal documents**](/docs/authentication/configuration/legal-compliance) is not enabled.

---

- `skipLegalChecks?`
- `boolean`

When set to `true` all legal checks are skipped. It is not recommended to skip legal checks unless you are migrating a user to Clerk.

---

- `createdAt`
- `string`

Expand Down Expand Up @@ -259,7 +273,8 @@ _User {
externalAccounts: [],
samlAccounts: [],
lastActiveAt: null,
createOrganizationEnabled: true
createOrganizationEnabled: true,
legalAcceptedAt: null
}
*/
```
Expand Down
6 changes: 4 additions & 2 deletions docs/references/backend/user/get-user-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ console.log(response)
web3Wallets: [],
externalAccounts: [Array],
lastActiveAt: 1707523200000,
createOrganizationEnabled: true
createOrganizationEnabled: true,
legalAcceptedAt: null
},
_User {
id: 'user_456',
Expand Down Expand Up @@ -170,7 +171,8 @@ console.log(response)
web3Wallets: [],
externalAccounts: [Array],
lastActiveAt: 1707523200000,
createOrganizationEnabled: true
createOrganizationEnabled: true,
legalAcceptedAt: null
},
...
],
Expand Down
3 changes: 2 additions & 1 deletion docs/references/backend/user/get-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ _User {
web3Wallets: [],
externalAccounts: [],
lastActiveAt: null,
createOrganizationEnabled: true
createOrganizationEnabled: true,
legalAcceptedAt: null
}
*/
```
Expand Down
17 changes: 16 additions & 1 deletion docs/references/backend/user/update-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ function updateUser(userId: string, params: UpdateUserParams): Promise<User>

---

- `legalAcceptedAt?`
- `Date`

The date when the user accepted the legal documents. `null` if [**Require express consent to legal documents**](/docs/authentication/configuration/legal-compliance) is not enabled.

---

- `skipLegalChecks?`
- `boolean`

When set to `true` all legal checks are skipped. It is not recommended to skip legal checks unless you are migrating a user to Clerk.

---

- `createdAt?`
- `Date`

Expand Down Expand Up @@ -267,7 +281,8 @@ _User {
],
samlAccounts: [],
lastActiveAt: 1720205704451,
createOrganizationEnabled: true
createOrganizationEnabled: true,
legalAcceptedAt: null
}
*/
```
Expand Down
2 changes: 1 addition & 1 deletion docs/references/javascript/user/user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ The ClerkJS SDK provides some helper [methods](#methods) on the `User` object to
- `legalAcceptedAt`
- `Date`

The date when the user accepted the legal documents. May be empty if [**Require express consent to legal documents**](/docs/authentication/configuration/legal-compliance) is not enabled.
The date when the user accepted the legal documents. `null` if [**Require express consent to legal documents**](/docs/authentication/configuration/legal-compliance) is not enabled.

---

Expand Down

0 comments on commit 43e0ef9

Please sign in to comment.