diff --git a/docs/docs/guides/providers/credentials-provider.md b/docs/docs/guides/providers/credentials-provider.md index a28760cc..d57299d6 100644 --- a/docs/docs/guides/providers/credentials-provider.md +++ b/docs/docs/guides/providers/credentials-provider.md @@ -69,7 +69,18 @@ providers: [ ... ``` -See the [callbacks documentation](/reference/configuration/auth-config#callbacks) for more information on how to interact with the token. +See the [callbacks documentation](/reference/configuration/auth-config#callbacks) for more information on how to interact with the token. For example, you can add additional information to the token by returning an object from the `jwt()` callback: + +```js +callbacks: { + async jwt(token, user, account, profile, isNewUser) { + if (user) { + token.id = user.id + } + return token + } +} +``` ## Example - Web3 / Signin With Ethereum diff --git a/packages/core/src/providers/credentials.ts b/packages/core/src/providers/credentials.ts index 59841348..11e16399 100644 --- a/packages/core/src/providers/credentials.ts +++ b/packages/core/src/providers/credentials.ts @@ -77,6 +77,19 @@ export type CredentialsProviderType = "Credentials" * with supporting usernames and passwords. * * ::: + * + * See the [callbacks documentation](/reference/configuration/auth-config#callbacks) for more information on how to interact with the token. For example, you can add additional information to the token by returning an object from the `jwt()` callback: + * + * ```js + * callbacks: { + * async jwt(token, user, account, profile, isNewUser) { + * if (user) { + * token.id = user.id + * } + * return token + * } + * } + * ``` * * @example * ```js