From 633b76f71949f3b7fa1f9f02fbe6b96d19a5053e Mon Sep 17 00:00:00 2001 From: Kawahara Shotaro <121674121+k-taro56@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:01:44 +0900 Subject: [PATCH] chore: Fix some documentation issues (#10980) * chore: Fix some documentation issue * chore: Update imports to use named import for Auth in providers Co-authored-by: Nico Domino --------- Co-authored-by: Nico Domino --- packages/core/src/index.ts | 4 +-- packages/core/src/providers/42-school.ts | 13 ++++--- packages/core/src/providers/apple.ts | 18 +++++----- packages/core/src/providers/asgardeo.ts | 28 +++++++-------- packages/core/src/providers/auth0.ts | 18 +++++----- packages/core/src/providers/authentik.ts | 12 +++++-- packages/core/src/providers/azure-ad.ts | 19 ++++++---- packages/core/src/providers/azure-devops.ts | 10 +++--- packages/core/src/providers/battlenet.ts | 12 +++++-- packages/core/src/providers/beyondidentity.ts | 20 +++++++---- packages/core/src/providers/box.ts | 8 +++-- packages/core/src/providers/boxyhq-saml.ts | 36 ++++++++++--------- packages/core/src/providers/bungie.ts | 12 +++++-- packages/core/src/providers/click-up.ts | 7 +++- packages/core/src/providers/cognito.ts | 12 +++++-- packages/core/src/providers/coinbase.ts | 11 ++++-- packages/core/src/providers/credentials.ts | 6 ++-- packages/core/src/providers/descope.ts | 26 +++++++------- packages/core/src/providers/discord.ts | 11 ++++-- packages/core/src/providers/dribbble.ts | 11 ++++-- packages/core/src/providers/dropbox.ts | 11 ++++-- .../src/providers/duende-identity-server6.ts | 18 ++++++---- packages/core/src/providers/eveonline.ts | 13 ++++--- packages/core/src/providers/facebook.ts | 11 ++++-- packages/core/src/providers/faceit.ts | 8 +++-- packages/core/src/providers/foursquare.ts | 11 ++++-- packages/core/src/providers/freshbooks.ts | 11 ++++-- packages/core/src/providers/fusionauth.ts | 13 +++++-- packages/core/src/providers/github.ts | 4 ++- packages/core/src/providers/gitlab.ts | 8 +++-- packages/core/src/providers/google.ts | 14 ++++---- packages/core/src/providers/hubspot.ts | 11 ++++-- .../core/src/providers/identity-server4.ts | 12 +++++-- packages/core/src/providers/instagram.ts | 11 ++++-- packages/core/src/providers/kakao.ts | 8 +++-- packages/core/src/providers/keycloak.ts | 12 +++++-- packages/core/src/providers/line.ts | 8 +++-- packages/core/src/providers/linkedin.ts | 11 ++++-- packages/core/src/providers/mailchimp.ts | 11 ++++-- packages/core/src/providers/mailru.ts | 8 +++-- packages/core/src/providers/mastodon.ts | 12 +++++-- packages/core/src/providers/mattermost.ts | 12 +++++-- packages/core/src/providers/medium.ts | 8 +++-- .../core/src/providers/microsoft-entra-id.ts | 20 +++++------ packages/core/src/providers/naver.ts | 8 +++-- packages/core/src/providers/netlify.ts | 11 ++++-- packages/core/src/providers/netsuite.ts | 10 +++--- packages/core/src/providers/notion.ts | 22 ++++++++---- packages/core/src/providers/okta.ts | 12 +++++-- packages/core/src/providers/onelogin.ts | 11 ++++-- packages/core/src/providers/ory-hydra.ts | 12 +++++-- packages/core/src/providers/osso.ts | 12 +++++-- packages/core/src/providers/osu.ts | 8 +++-- packages/core/src/providers/passage.ts | 12 +++++-- packages/core/src/providers/patreon.ts | 11 ++++-- packages/core/src/providers/pinterest.ts | 11 ++++-- packages/core/src/providers/pipedrive.ts | 11 ++++-- packages/core/src/providers/reddit.ts | 12 ++++--- packages/core/src/providers/salesforce.ts | 11 ++++-- packages/core/src/providers/simplelogin.ts | 2 +- packages/core/src/providers/slack.ts | 8 +++-- packages/core/src/providers/spotify.ts | 11 ++++-- packages/core/src/providers/strava.ts | 8 +++-- packages/core/src/providers/tiktok.ts | 8 +++-- packages/core/src/providers/todoist.ts | 11 ++++-- packages/core/src/providers/trakt.ts | 8 +++-- packages/core/src/providers/twitch.ts | 8 +++-- packages/core/src/providers/twitter.ts | 15 +++++--- packages/core/src/providers/united-effects.ts | 8 +++-- packages/core/src/providers/vk.ts | 8 ++--- packages/core/src/providers/webex.ts | 8 +++-- packages/core/src/providers/wikimedia.ts | 11 ++++-- packages/core/src/providers/wordpress.ts | 11 ++++-- packages/core/src/providers/workos.ts | 14 +++++--- packages/core/src/providers/yandex.ts | 14 ++++++-- packages/core/src/providers/zitadel.ts | 13 ++++--- packages/core/src/providers/zoho.ts | 8 +++-- packages/core/src/providers/zoom.ts | 8 +++-- 78 files changed, 602 insertions(+), 314 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index f88617a9d3..a81aff9374 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -86,10 +86,10 @@ export async function Auth( * * @example * ```ts - * import Auth from "@auth/core" + * import { Auth } from "@auth/core" * * const request = new Request("https://example.com") - * const response = await AuthHandler(request, { + * const response = await Auth(request, { * providers: [Google], * secret: "...", * trustHost: true, diff --git a/packages/core/src/providers/42-school.ts b/packages/core/src/providers/42-school.ts index 8314e768b3..95aaa099ed 100644 --- a/packages/core/src/providers/42-school.ts +++ b/packages/core/src/providers/42-school.ts @@ -185,13 +185,18 @@ export interface FortyTwoProfile extends UserData, Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" - * import 42School from "@auth/core/providers/42-school" + *```ts + * import { Auth } from "@auth/core" + * import FortyTwoSchool from "@auth/core/providers/42-school" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [42School({ clientId: 42_SCHOOL_CLIENT_ID, clientSecret: 42_SCHOOL_CLIENT_SECRET })], + * providers: [ + * FortyTwoSchool({ + * clientId: FORTY_TWO_SCHOOL_CLIENT_ID, + * clientSecret: FORTY_TWO_SCHOOL_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/apple.ts b/packages/core/src/providers/apple.ts index 6702eea621..bb8722b786 100644 --- a/packages/core/src/providers/apple.ts +++ b/packages/core/src/providers/apple.ts @@ -105,18 +105,16 @@ export interface AppleProfile extends Record { * ``` * * #### Configuration + * ```ts + * import { Auth } from "@auth/core" + * import Apple from "@auth/core/providers/apple" * - * Import the provider and configure it in your **Auth.js** initialization file: - * - * ```ts title="pages/api/auth/[...nextauth].ts" - * import NextAuth from "next-auth" - * import AppleProvider from "next-auth/providers/apple" - * - * export default NextAuth({ + * const request = new Request(origin) + * const response = await Auth(request, { * providers: [ - * AppleProvider({ - * clientId: process.env.APPLE_ID, - * clientSecret: process.env.APPLE_SECRET, + * Apple({ + * clientId: APPLE_CLIENT_ID, + * clientSecret: APPLE_CLIENT_SECRET, * }), * ], * }) diff --git a/packages/core/src/providers/asgardeo.ts b/packages/core/src/providers/asgardeo.ts index 4e61516ba4..d65014445b 100644 --- a/packages/core/src/providers/asgardeo.ts +++ b/packages/core/src/providers/asgardeo.ts @@ -43,21 +43,19 @@ export interface AsgardeoProfile extends Record { * ``` * * #### Configuration - * - * Import the provider and configure it in your **Auth.js** initialization file: - * - * ```ts title="pages/api/auth/[...nextauth].ts" - * import NextAuth from "next-auth" - * import AsgardeoProvider from "next-auth/providers/asgardeo"; - * - * export default NextAuth({ - * providers: [ - * AsgardeoProvider({ - * clientId: process.env.ASGARDEO_CLIENT_ID, - * clientSecret: process.env.ASGARDEO_CLIENT_SECRET, - * issuer: process.env.ASGARDEO_ISSUER - * }), - * ], + *```ts + * import { Auth } from "@auth/core" + * import Asgarde from "@auth/core/providers/asgardeo"; + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * Asgardeo({ + * clientId: ASGARDEO_CLIENT_ID, + * clientSecret: ASGARDEO_CLIENT_SECRET, + * issuer: ASGARDEO_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/auth0.ts b/packages/core/src/providers/auth0.ts index ae2b8d8db4..0b239f0584 100644 --- a/packages/core/src/providers/auth0.ts +++ b/packages/core/src/providers/auth0.ts @@ -83,18 +83,16 @@ export interface Auth0Profile extends Record { * ``` * * #### Configuration + * ```ts + * import { Auth } from "@auth/core" + * import Auth0 from "@auth/core/providers/auth0" * - * Import the provider and configure it in your **Auth.js** initialization file: - * - * ```ts title="pages/api/auth/[...nextauth].ts" - * import NextAuth from "next-auth" - * import Auth0Provider from "next-auth/providers/auth0" - * - * export default NextAuth({ + * const request = new Request(origin) + * const response = await Auth(request, { * providers: [ - * Auth0Provider({ - * clientId: process.env.AUTH0_ID, - * clientSecret: process.env.AUTH0_SECRET, + * Auth0({ + * clientId: AUTH0_ID, + * clientSecret: AUTH0_SECRET, * }), * ], * }) diff --git a/packages/core/src/providers/authentik.ts b/packages/core/src/providers/authentik.ts index b3bbfd6aef..0bb3608a87 100644 --- a/packages/core/src/providers/authentik.ts +++ b/packages/core/src/providers/authentik.ts @@ -42,13 +42,19 @@ export interface AuthentikProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Authentik from "@auth/core/providers/authentik" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Authentik({ clientId: AUTHENTIK_CLIENT_ID, clientSecret: AUTHENTIK_CLIENT_SECRET, issuer: AUTHENTIK_ISSUER })], + * providers: [ + * Authentik({ + * clientId: AUTHENTIK_CLIENT_ID, + * clientSecret: AUTHENTIK_CLIENT_SECRET, + * issuer: AUTHENTIK_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/azure-ad.ts b/packages/core/src/providers/azure-ad.ts index f8d5586825..97f950c401 100644 --- a/packages/core/src/providers/azure-ad.ts +++ b/packages/core/src/providers/azure-ad.ts @@ -33,13 +33,18 @@ export interface AzureADProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import AzureAd from "@auth/core/providers/azure-ad" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [AzureAd({ clientId: AZURE_AD_CLIENT_ID, clientSecret: AZURE_AD_CLIENT_SECRET })], + * providers: [ + * AzureAd({ + * clientId: AZURE_AD_CLIENT_ID, + * clientSecret: AZURE_AD_CLIENT_SECRET, + * }), + * ], * }) * ``` * @@ -79,14 +84,14 @@ export interface AzureADProfile extends Record { * Azure AD returns the profile picture in an ArrayBuffer, instead of just a URL to the image, so our provider converts it to a base64 encoded image string and returns that instead. See: https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0#examples. The default image size is 48x48 to avoid [running out of space](https://next-auth.js.org/faq#:~:text=What%20are%20the%20disadvantages%20of%20JSON%20Web%20Tokens%3F) in case the session is saved as a JWT. * ::: * - * In `pages/api/auth/[...nextauth].js` find or add the `AzureAD` entries: + * In `auth.ts` find or add the `AzureAD` entries: * - * ```js - * import AzureADProvider from "next-auth/providers/azure-ad"; + * ```ts + * import AzureAd from "@auth/core/providers/azure-ad" * * ... * providers: [ - * AzureADProvider({ + * AzureAD({ * clientId: process.env.AZURE_AD_CLIENT_ID, * clientSecret: process.env.AZURE_AD_CLIENT_SECRET, * tenantId: process.env.AZURE_AD_TENANT_ID, diff --git a/packages/core/src/providers/azure-devops.ts b/packages/core/src/providers/azure-devops.ts index 3f83e79760..51c4a2ea91 100644 --- a/packages/core/src/providers/azure-devops.ts +++ b/packages/core/src/providers/azure-devops.ts @@ -64,11 +64,11 @@ export interface AzureDevOpsProfile extends Record { * * ## Example * - * ```js title="pages/api/auth/[...nextauth].js" - * import AzureDevOpsProvider from "next-auth/providers/azure-devops" + * ```ts + * import AzureDevOps from "@auth/core/providers/azure-devops" * ... * providers: [ - * AzureDevOpsProvider({ + * AzureDevOps({ * clientId: process.env.AZURE_DEVOPS_APP_ID, * clientSecret: process.env.AZURE_DEVOPS_CLIENT_SECRET, * scope: process.env.AZURE_DEVOPS_SCOPE, @@ -81,7 +81,7 @@ export interface AzureDevOpsProfile extends Record { * * Use the [main guide](/guides/basics/refresh-token-rotation) as your starting point with the following considerations: * - * ```js title="pages/api/auth/[...nextauth].js" + * ```ts * async jwt({ token, user, account }) { * ... * // The token has an absolute expiration time @@ -99,7 +99,7 @@ export interface AzureDevOpsProfile extends Record { * body: new URLSearchParams({ * client_assertion_type: * "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", - * client_assertion: AZURE_DEVOPS_CLIENT_SECRET, + * client_assertion: process.env.AZURE_DEVOPS_CLIENT_SECRET, * grant_type: "refresh_token", * assertion: token.refreshToken, * redirect_uri: diff --git a/packages/core/src/providers/battlenet.ts b/packages/core/src/providers/battlenet.ts index 5991c86256..c429709776 100644 --- a/packages/core/src/providers/battlenet.ts +++ b/packages/core/src/providers/battlenet.ts @@ -33,13 +33,19 @@ export type BattleNetIssuer = * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import BattleNet from "@auth/core/providers/battlenet" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [BattleNet({ clientId: BATTLENET_CLIENT_ID, clientSecret: BATTLENET_CLIENT_SECRET. issuer: BATTLENET_ISSUER })], + * providers: [ + * BattleNet({ + * clientId: BATTLENET_CLIENT_ID, + * clientSecret: BATTLENET_CLIENT_SECRET, + * issuer: BATTLENET_ISSUER, + * }), + * ], * }) * ``` * issuer must be one of these values, based on the available regions: diff --git a/packages/core/src/providers/beyondidentity.ts b/packages/core/src/providers/beyondidentity.ts index 5b0a867ad0..68fe36c2ea 100644 --- a/packages/core/src/providers/beyondidentity.ts +++ b/packages/core/src/providers/beyondidentity.ts @@ -26,26 +26,34 @@ export interface BeyondIdentityProfile { /** * Add Beyond Identity login to your page. * - * @example + * ### Setup * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/beyondidentity + * ``` + * + * #### Configuration * ```ts * import { Auth } from "@auth/core" * import BeyondIdentity from "@auth/core/providers/beyondidentity" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [BeyondIdentity({ clientId: BEYOND_IDENTITY_CLIENT_ID, clientSecret: BEYOND_IDENTITY_CLIENT_SECRET, issuer: BEYOND_IDENTITY_ISSUER })], + * providers: [ + * BeyondIdentity({ + * clientId: BEYOND_IDENTITY_CLIENT_ID, + * clientSecret: BEYOND_IDENTITY_CLIENT_SECRET, + * issuer: BEYOND_IDENTITY_ISSUER, + * }), + * ], * }) * ``` * - * --- - * * ### Resources * * - [Beyond Identity Developer Docs](https://developer.beyondidentity.com/) * - * --- - * * ### Notes * * By default, Auth.js assumes that the BeyondIdentity provider is diff --git a/packages/core/src/providers/box.ts b/packages/core/src/providers/box.ts index b4eff59664..b7f84a4cb3 100644 --- a/packages/core/src/providers/box.ts +++ b/packages/core/src/providers/box.ts @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Box from "@auth/core/providers/box" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Box({ clientId: BOX_CLIENT_ID, clientSecret: BOX_CLIENT_SECRET })], + * providers: [ + * Box({ clientId: BOX_CLIENT_ID, clientSecret: BOX_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/boxyhq-saml.ts b/packages/core/src/providers/boxyhq-saml.ts index 8624af0797..f1ae7a370d 100644 --- a/packages/core/src/providers/boxyhq-saml.ts +++ b/packages/core/src/providers/boxyhq-saml.ts @@ -34,33 +34,37 @@ export interface BoxyHQSAMLProfile extends Record { * #### Configuration * * For OAuth 2.0 Flow: - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import BoxyHQ from "@auth/core/providers/boxyhq-saml" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [BoxyHQ({ - * authorization: { params: { scope: "" } }, // This is needed for OAuth 2.0 flow, otherwise default to openid - * clientId: BOXYHQ_SAML_CLIENT_ID, - * clientSecret: BOXYHQ_SAML_CLIENT_SECRET, - * issuer: BOXYHQ_SAML_ISSUER - * })], + * providers: [ + * BoxyHQ({ + * authorization: { params: { scope: "" } }, // This is needed for OAuth 2.0 flow, otherwise default to openid + * clientId: BOXYHQ_SAML_CLIENT_ID, + * clientSecret: BOXYHQ_SAML_CLIENT_SECRET, + * issuer: BOXYHQ_SAML_ISSUER, + * }), + * ], * }) * ``` * For OIDC Flow: * - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import BoxyHQ from "@auth/core/providers/boxyhq-saml" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [BoxyHQ({ - * clientId: BOXYHQ_SAML_CLIENT_ID, - * clientSecret: BOXYHQ_SAML_CLIENT_SECRET, - * issuer: BOXYHQ_SAML_ISSUER - * })], + * providers: [ + * BoxyHQ({ + * clientId: BOXYHQ_SAML_CLIENT_ID, + * clientSecret: BOXYHQ_SAML_CLIENT_SECRET, + * issuer: BOXYHQ_SAML_ISSUER, + * }), + * ], * }) * ``` * @@ -78,7 +82,7 @@ export interface BoxyHQSAMLProfile extends Record { * On the client side you'll need to pass additional parameters `tenant` and `product` to the `signIn` function. This will allow BoxyHQL SAML to figure out the right SAML configuration and take your user to the right SAML Identity Provider to sign them in. * * ```tsx - * import { signIn } from "next-auth/react"; + * import { signIn } from "auth"; * ... * * // Map your users's email to a tenant and product diff --git a/packages/core/src/providers/bungie.ts b/packages/core/src/providers/bungie.ts index 14aa6a809f..3fcd803395 100644 --- a/packages/core/src/providers/bungie.ts +++ b/packages/core/src/providers/bungie.ts @@ -21,13 +21,19 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Bungie from "@auth/core/providers/bungie" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Bungie({ clientId: BUNGIE_CLIENT_ID, clientSecret: BUNGIE_CLIENT_SECRET, headers: { "X-API-Key": BUNGIE_API_KEY } })], + * providers: [ + * Bungie({ + * clientId: BUNGIE_CLIENT_ID, + * clientSecret: BUNGIE_CLIENT_SECRET, + * headers: { "X-API-Key": BUNGIE_API_KEY }, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/click-up.ts b/packages/core/src/providers/click-up.ts index 3d374b66ad..f923424fcc 100644 --- a/packages/core/src/providers/click-up.ts +++ b/packages/core/src/providers/click-up.ts @@ -38,7 +38,12 @@ export interface ClickUpProfile { * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [ClickUp({ clientId: CLICKUP_CLIENT_ID, clientSecret: CLICKUP_CLIENT_SECRET })], + * providers: [ + * ClickUp({ + * clientId: CLICKUP_CLIENT_ID, + * clientSecret: CLICKUP_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/cognito.ts b/packages/core/src/providers/cognito.ts index 6f67b03b15..27bad9947c 100644 --- a/packages/core/src/providers/cognito.ts +++ b/packages/core/src/providers/cognito.ts @@ -28,13 +28,19 @@ export interface CognitoProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Cognito from "@auth/core/providers/cognito" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Cognito({ clientId: COGNITO_CLIENT_ID, clientSecret: COGNITO_CLIENT_SECRET, issuer: COGNITO_ISSUER })], + * providers: [ + * Cognito({ + * clientId: COGNITO_CLIENT_ID, + * clientSecret: COGNITO_CLIENT_SECRET, + * issuer: COGNITO_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/coinbase.ts b/packages/core/src/providers/coinbase.ts index 5739aee9e4..ab5d6c041b 100644 --- a/packages/core/src/providers/coinbase.ts +++ b/packages/core/src/providers/coinbase.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Coinbase from "@auth/core/providers/coinbase" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Coinbase({ clientId: COINBASE_CLIENT_ID, clientSecret: COINBASE_CLIENT_SECRET })], + * providers: [ + * Coinbase({ + * clientId: COINBASE_CLIENT_ID, + * clientSecret: COINBASE_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/credentials.ts b/packages/core/src/providers/credentials.ts index 0e201ad8a4..1f8a07e2ab 100644 --- a/packages/core/src/providers/credentials.ts +++ b/packages/core/src/providers/credentials.ts @@ -102,7 +102,7 @@ export type CredentialsProviderType = "Credentials" * * See the [callbacks documentation](/reference/core#authconfig#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 + * ```ts * callbacks: { * async jwt({ token, user, account, profile, isNewUser }) { * if (user) { @@ -114,8 +114,8 @@ export type CredentialsProviderType = "Credentials" * ``` * * @example - * ```js - * import Auth from "@auth/core" + * ```ts + * import { Auth } from "@auth/core" * import Credentials from "@auth/core/providers/credentials" * * const request = new Request("https://example.com") diff --git a/packages/core/src/providers/descope.ts b/packages/core/src/providers/descope.ts index 8f38440052..a2c0eb80a9 100644 --- a/packages/core/src/providers/descope.ts +++ b/packages/core/src/providers/descope.ts @@ -45,20 +45,18 @@ export interface DescopeProfile { * ``` * * #### Configuration - * - * Import the provider and configure it in your **Auth.js** initialization file: - * - * ```ts title="pages/api/auth/[...nextauth].ts" - * import NextAuth from "next-auth" - * import DescopeProvider from "next-auth/providers/descope"; - * - * export default NextAuth({ - * providers: [ - * DescopeProvider({ - * clientId: process.env.DESCOPE_ID, - * clientSecret: process.env.DESCOPE_SECRET, - * }), - * ], + * ```ts + * import { Auth } from "@auth/core" + * import Descope from "@auth/core/providers/descope" + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * Descope({ + * clientId: DESCOPE_ID, + * clientSecret: DESCOPE_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/discord.ts b/packages/core/src/providers/discord.ts index f63a293735..5fb6c103db 100644 --- a/packages/core/src/providers/discord.ts +++ b/packages/core/src/providers/discord.ts @@ -97,13 +97,18 @@ export interface DiscordProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Discord from "@auth/core/providers/discord" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Discord({ clientId: DISCORD_CLIENT_ID, clientSecret: DISCORD_CLIENT_SECRET })], + * providers: [ + * Discord({ + * clientId: DISCORD_CLIENT_ID, + * clientSecret: DISCORD_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/dribbble.ts b/packages/core/src/providers/dribbble.ts index 3aa9db29da..10a8775fc2 100644 --- a/packages/core/src/providers/dribbble.ts +++ b/packages/core/src/providers/dribbble.ts @@ -29,13 +29,18 @@ export interface DribbbleProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Dribbble from "@auth/core/providers/dribbble" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Dribbble({ clientId: DRIBBBLE_CLIENT_ID, clientSecret: DRIBBBLE_CLIENT_SECRET })], + * providers: [ + * Dribbble({ + * clientId: DRIBBBLE_CLIENT_ID, + * clientSecret: DRIBBBLE_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/dropbox.ts b/packages/core/src/providers/dropbox.ts index 3cf956a73d..b6bd1a1070 100644 --- a/packages/core/src/providers/dropbox.ts +++ b/packages/core/src/providers/dropbox.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Dropbox from "@auth/core/providers/dropbox" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Dropbox({ clientId: DROPBOX_CLIENT_ID, clientSecret: DROPBOX_CLIENT_SECRET })], + * providers: [ + * Dropbox({ + * clientId: DROPBOX_CLIENT_ID, + * clientSecret: DROPBOX_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/duende-identity-server6.ts b/packages/core/src/providers/duende-identity-server6.ts index 11f73f3246..494cea0b4b 100644 --- a/packages/core/src/providers/duende-identity-server6.ts +++ b/packages/core/src/providers/duende-identity-server6.ts @@ -28,13 +28,19 @@ export interface DuendeISUser extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import DuendeIdentityServer6 from "@auth/core/providers/duende-identity-server6" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [DuendeIdentityServer6({ clientId: DIS6_CLIENT_ID, clientSecret: DIS6_CLIENT_SECRET, issuer: DIS6_ISSUER })], + * providers: [ + * DuendeIdentityServer6({ + * clientId: DIS6_CLIENT_ID, + * clientSecret: DIS6_CLIENT_SECRET, + * issuer: DIS6_ISSUER, + * }), + * ], * }) * ``` * @@ -53,10 +59,10 @@ export interface DuendeISUser extends Record { * * You can sign in to the demo service with either bob/bob or alice/alice. * - * ```js title=pages/api/auth/[...nextauth].js - * import DuendeIDS6Provider from "next-auth/providers/duende-identity-server6" + * ```ts + * import DuendeIdentityServer6 from "@auth/core/providers/duende-identity-server6" * providers: [ - * DuendeIDS6Provider({ + * DuendeIdentityServer6({ * clientId: "interactive.confidential", * clientSecret: "secret", * issuer: "https://demo.duendesoftware.com", diff --git a/packages/core/src/providers/eveonline.ts b/packages/core/src/providers/eveonline.ts index 788ea0d30a..56631632af 100644 --- a/packages/core/src/providers/eveonline.ts +++ b/packages/core/src/providers/eveonline.ts @@ -31,13 +31,18 @@ export interface EVEOnlineProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import EveOnline from "@auth/core/providers/eveonline" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [EveOnline({ clientId: EVEONLINE_CLIENT_ID, clientSecret: EVEONLINE_CLIENT_SECRET })], + * providers: [ + * EveOnline({ + * clientId: EVEONLINE_CLIENT_ID, + * clientSecret: EVEONLINE_CLIENT_SECRET, + * }), + * ], * }) * ``` * @@ -53,7 +58,7 @@ export interface EVEOnlineProfile extends Record { * * :::tip * If using JWT for the session, you can add the `CharacterID` to the JWT and session. Example: - * ```js + * ```ts * options: { * jwt: { * secret: process.env.JWT_SECRET, diff --git a/packages/core/src/providers/facebook.ts b/packages/core/src/providers/facebook.ts index 6ebb114777..3eab1c4883 100644 --- a/packages/core/src/providers/facebook.ts +++ b/packages/core/src/providers/facebook.ts @@ -33,13 +33,18 @@ export interface FacebookProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Facebook from "@auth/core/providers/facebook" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Facebook({ clientId: FACEBOOK_CLIENT_ID, clientSecret: FACEBOOK_CLIENT_SECRET })], + * providers: [ + * Facebook({ + * clientId: FACEBOOK_CLIENT_ID, + * clientSecret: FACEBOOK_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/faceit.ts b/packages/core/src/providers/faceit.ts index 2519141bb7..634fbbc227 100644 --- a/packages/core/src/providers/faceit.ts +++ b/packages/core/src/providers/faceit.ts @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import FACEIT from "@auth/core/providers/faceit" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [FACEIT({ clientId: FACEIT_CLIENT_ID, clientSecret: FACEIT_CLIENT_SECRET })], + * providers: [ + * FACEIT({ clientId: FACEIT_CLIENT_ID, clientSecret: FACEIT_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/foursquare.ts b/packages/core/src/providers/foursquare.ts index 3f3417d3b7..7665bdf7d2 100644 --- a/packages/core/src/providers/foursquare.ts +++ b/packages/core/src/providers/foursquare.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import FourSquare from "@auth/core/providers/foursquare" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [FourSquare({ clientId: FOURSQUARE_CLIENT_ID, clientSecret: FOURSQUARE_CLIENT_SECRET })], + * providers: [ + * FourSquare({ + * clientId: FOURSQUARE_CLIENT_ID, + * clientSecret: FOURSQUARE_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/freshbooks.ts b/packages/core/src/providers/freshbooks.ts index f61a6f6005..b21dc53cc0 100644 --- a/packages/core/src/providers/freshbooks.ts +++ b/packages/core/src/providers/freshbooks.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import FreshBooks from "@auth/core/providers/freshbooks" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [FreshBooks({ clientId: FRESHBOOKS_CLIENT_ID, clientSecret: FRESHBOOKS_CLIENT_SECRET })], + * providers: [ + * FreshBooks({ + * clientId: FRESHBOOKS_CLIENT_ID, + * clientSecret: FRESHBOOKS_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/fusionauth.ts b/packages/core/src/providers/fusionauth.ts index 746f1c23df..261ffd1a62 100644 --- a/packages/core/src/providers/fusionauth.ts +++ b/packages/core/src/providers/fusionauth.ts @@ -42,13 +42,20 @@ export interface FusionAuthProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import FusionAuth from "@auth/core/providers/fusionauth" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [FusionAuth({ clientId: FUSIONAUTH_CLIENT_ID, clientSecret: FUSIONAUTH_CLIENT_SECRET, tenantId: FUSIONAUTH_TENANT_ID, issuer: FUSIONAUTH_ISSUER })], + * providers: [ + * FusionAuth({ + * clientId: FUSIONAUTH_CLIENT_ID, + * clientSecret: FUSIONAUTH_CLIENT_SECRET, + * tenantId: FUSIONAUTH_TENANT_ID, + * issuer: FUSIONAUTH_ISSUER, + * }), + * ], * }) * ``` * :::warning diff --git a/packages/core/src/providers/github.ts b/packages/core/src/providers/github.ts index 2d8cd55731..7284a12116 100644 --- a/packages/core/src/providers/github.ts +++ b/packages/core/src/providers/github.ts @@ -85,7 +85,9 @@ export interface GitHubProfile { * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [GitHub({ clientId: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET })], + * providers: [ + * GitHub({ clientId: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/gitlab.ts b/packages/core/src/providers/gitlab.ts index 9f24bd3175..b63149a9cc 100644 --- a/packages/core/src/providers/gitlab.ts +++ b/packages/core/src/providers/gitlab.ts @@ -66,13 +66,15 @@ export interface GitLabProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import GitLab from "@auth/core/providers/gitlab" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [GitLab({ clientId: GITLAB_CLIENT_ID, clientSecret: GITLAB_CLIENT_SECRET })], + * providers: [ + * GitLab({ clientId: GITLAB_CLIENT_ID, clientSecret: GITLAB_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/google.ts b/packages/core/src/providers/google.ts index 43324eb860..211472c6e7 100644 --- a/packages/core/src/providers/google.ts +++ b/packages/core/src/providers/google.ts @@ -40,13 +40,15 @@ export interface GoogleProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Google from "@auth/core/providers/google" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Google({ clientId: GOOGLE_CLIENT_ID, clientSecret: GOOGLE_CLIENT_SECRET })], + * providers: [ + * Google({ clientId: GOOGLE_CLIENT_ID, clientSecret: GOOGLE_CLIENT_SECRET }), + * ], * }) * ``` * @@ -76,10 +78,10 @@ export interface GoogleProfile extends Record { * * If you need access to the RefreshToken or AccessToken for a Google account and you are not using a database to persist user accounts, this may be something you need to do. * - * ```js title="pages/api/auth/[...nextauth].js" + * ```ts * const options = { * providers: [ - * GoogleProvider({ + * Google({ * clientId: process.env.GOOGLE_ID, * clientSecret: process.env.GOOGLE_SECRET, * authorization: { @@ -101,7 +103,7 @@ export interface GoogleProfile extends Record { * * You can use this property to restrict access to people with verified accounts at a particular domain. * - * ```js + * ```ts * const options = { * ... * callbacks: { diff --git a/packages/core/src/providers/hubspot.ts b/packages/core/src/providers/hubspot.ts index 25159e1034..a14841e74f 100644 --- a/packages/core/src/providers/hubspot.ts +++ b/packages/core/src/providers/hubspot.ts @@ -29,13 +29,18 @@ interface HubSpotProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import HubSpot from "@auth/core/providers/hubspot" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [HubSpot({ clientId: HUBSPOT_CLIENT_ID, clientSecret: HUBSPOT_CLIENT_SECRET })], + * providers: [ + * HubSpot({ + * clientId: HUBSPOT_CLIENT_ID, + * clientSecret: HUBSPOT_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/identity-server4.ts b/packages/core/src/providers/identity-server4.ts index 24a2a2aee4..be58d531c5 100644 --- a/packages/core/src/providers/identity-server4.ts +++ b/packages/core/src/providers/identity-server4.ts @@ -21,13 +21,19 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import IdentityServer4 from "@auth/core/providers/identity-server4" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [IdentityServer4({ clientId: IDENTITY_SERVER4_CLIENT_ID, clientSecret: IDENTITY_SERVER4_CLIENT_SECRET, issuer: IDENTITY_SERVER4_ISSUER })], + * providers: [ + * IdentityServer4({ + * clientId: IDENTITY_SERVER4_CLIENT_ID, + * clientSecret: IDENTITY_SERVER4_CLIENT_SECRET, + * issuer: IDENTITY_SERVER4_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/instagram.ts b/packages/core/src/providers/instagram.ts index 2b735a3a9d..bc467890df 100644 --- a/packages/core/src/providers/instagram.ts +++ b/packages/core/src/providers/instagram.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Instagram from "@auth/core/providers/instagram" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Instagram({ clientId: INSTAGRAM_CLIENT_ID, clientSecret: INSTAGRAM_CLIENT_SECRET })], + * providers: [ + * Instagram({ + * clientId: INSTAGRAM_CLIENT_ID, + * clientSecret: INSTAGRAM_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/kakao.ts b/packages/core/src/providers/kakao.ts index 30c575b57d..f6d7d1df2e 100644 --- a/packages/core/src/providers/kakao.ts +++ b/packages/core/src/providers/kakao.ts @@ -88,13 +88,15 @@ export interface KakaoProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Kakao from "@auth/core/providers/kakao" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Kakao({ clientId: KAKAO_CLIENT_ID, clientSecret: KAKAO_CLIENT_SECRET })], + * providers: [ + * Kakao({ clientId: KAKAO_CLIENT_ID, clientSecret: KAKAO_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/keycloak.ts b/packages/core/src/providers/keycloak.ts index bca9fd5547..8708a43999 100644 --- a/packages/core/src/providers/keycloak.ts +++ b/packages/core/src/providers/keycloak.ts @@ -45,13 +45,19 @@ export interface KeycloakProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Keycloak from "@auth/core/providers/keycloak" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Keycloak({ clientId: KEYCLOAK_CLIENT_ID, clientSecret: KEYCLOAK_CLIENT_SECRET, issuer: KEYCLOAK_ISSUER, })], + * providers: [ + * Keycloak({ + * clientId: KEYCLOAK_CLIENT_ID, + * clientSecret: KEYCLOAK_CLIENT_SECRET, + * issuer: KEYCLOAK_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/line.ts b/packages/core/src/providers/line.ts index f0f7d4b190..b4a2c32451 100644 --- a/packages/core/src/providers/line.ts +++ b/packages/core/src/providers/line.ts @@ -33,13 +33,15 @@ export interface LineProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import LINE from "@auth/core/providers/line" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [LINE({ clientId: LINE_CLIENT_ID, clientSecret: LINE_CLIENT_SECRET })], + * providers: [ + * LINE({ clientId: LINE_CLIENT_ID, clientSecret: LINE_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/linkedin.ts b/packages/core/src/providers/linkedin.ts index d18ebb10fa..339e9510af 100644 --- a/packages/core/src/providers/linkedin.ts +++ b/packages/core/src/providers/linkedin.ts @@ -33,13 +33,18 @@ export interface LinkedInProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import LinkedIn from "@auth/core/providers/linkedin" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [LinkedIn({ clientId: LINKEDIN_CLIENT_ID, clientSecret: LINKEDIN_CLIENT_SECRET })], + * providers: [ + * LinkedIn({ + * clientId: LINKEDIN_CLIENT_ID, + * clientSecret: LINKEDIN_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/mailchimp.ts b/packages/core/src/providers/mailchimp.ts index c63f9562f5..a8786970e5 100644 --- a/packages/core/src/providers/mailchimp.ts +++ b/packages/core/src/providers/mailchimp.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Mailchimp from "@auth/core/providers/mailchimp" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Mailchimp({ clientId: MAILCHIMP_CLIENT_ID, clientSecret: MAILCHIMP_CLIENT_SECRET })], + * providers: [ + * Mailchimp({ + * clientId: MAILCHIMP_CLIENT_ID, + * clientSecret: MAILCHIMP_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/mailru.ts b/packages/core/src/providers/mailru.ts index 281afafdc2..b7c9503fd0 100644 --- a/packages/core/src/providers/mailru.ts +++ b/packages/core/src/providers/mailru.ts @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Mailru from "@auth/core/providers/mailru" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Mailru({ clientId: MAILRU_CLIENT_ID, clientSecret: MAILRU_CLIENT_SECRET })], + * providers: [ + * Mailru({ clientId: MAILRU_CLIENT_ID, clientSecret: MAILRU_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/mastodon.ts b/packages/core/src/providers/mastodon.ts index 5af91536b9..03d822f062 100644 --- a/packages/core/src/providers/mastodon.ts +++ b/packages/core/src/providers/mastodon.ts @@ -41,13 +41,19 @@ export interface MastodonProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Mastodon from "@auth/core/providers/mastodon" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Mastodon({ clientId: MASTODON_CLIENT_ID, clientSecret: MASTODON_CLIENT_SECRET, issuer: MASTODON_ISSUER })], + * providers: [ + * Mastodon({ + * clientId: MASTODON_CLIENT_ID, + * clientSecret: MASTODON_CLIENT_SECRET, + * issuer: MASTODON_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/mattermost.ts b/packages/core/src/providers/mattermost.ts index b301d614c4..474a00f92b 100644 --- a/packages/core/src/providers/mattermost.ts +++ b/packages/core/src/providers/mattermost.ts @@ -77,13 +77,19 @@ export interface MattermostProfile { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Mattermost from "@auth/core/providers/mattermost" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Mattermost({ clientId: MATTERMOST_CLIENT_ID, clientSecret: MATTERMOST_CLIENT_SECRET, issuer: MATTERMOST_ISSUER // The base url of your Mattermost instance. e.g `https://my-cool-server.cloud.mattermost.com` })], + * providers: [ + * Mattermost({ + * clientId: MATTERMOST_CLIENT_ID, + * clientSecret: MATTERMOST_CLIENT_SECRET, + * issuer: MATTERMOST_ISSUER, // The base url of your Mattermost instance. e.g `https://my-cool-server.cloud.mattermost.com` + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/medium.ts b/packages/core/src/providers/medium.ts index e80e88e731..a1e38b0a56 100644 --- a/packages/core/src/providers/medium.ts +++ b/packages/core/src/providers/medium.ts @@ -22,13 +22,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Medium from "@auth/core/providers/medium" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Medium({ clientId: MEDIUM_CLIENT_ID, clientSecret: MEDIUM_CLIENT_SECRET })], + * providers: [ + * Medium({ clientId: MEDIUM_CLIENT_ID, clientSecret: MEDIUM_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/microsoft-entra-id.ts b/packages/core/src/providers/microsoft-entra-id.ts index a3069276c4..61982a6f74 100644 --- a/packages/core/src/providers/microsoft-entra-id.ts +++ b/packages/core/src/providers/microsoft-entra-id.ts @@ -46,15 +46,16 @@ export type MicrosoftEntraIDOptions

= * * ### Configuration * ```ts - * import NextAuth from "next-auth" - * import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id"; + * import { Auth } from "@auth/core" + * import MicrosoftEntraID from "@auth/core/providers/microsoft-entra-id" * - * const { handlers, auth, signIn, signOut } = NextAuth({ + * const request = new Request(origin) + * const response = await Auth(request, { * providers: [ * MicrosoftEntraID({ - * clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID, - * clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET - * }) + * clientId: AUTH_MICROSOFT_ENTRA_ID_ID, + * clientSecret: AUTH_MICROSOFT_ENTRA_ID_SECRET, + * }), * ], * }) * ``` @@ -94,10 +95,10 @@ export type MicrosoftEntraIDOptions

= * Microsoft Entra returns the profile picture in an ArrayBuffer, instead of just a URL to the image, so our provider converts it to a base64 encoded image string and returns that instead. See: https://learn.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0&tabs=http#examples. The default image size is 48x48 to avoid [running out of space](https://next-auth.js.org/faq#:~:text=What%20are%20the%20disadvantages%20of%20JSON%20Web%20Tokens%3F) in case the session is saved as a JWT. * ::: * - * In `app/api/auth/[...nextauth]/route.js` find or add the `Entra` entries: + * In `auth.ts` find or add the `Entra` entries: * - * ```js - * import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id"; + * ```ts + * import MicrosoftEntraID from "@auth/core/providers/microsoft-entra-id" * * providers: [ * MicrosoftEntraID({ @@ -106,7 +107,6 @@ export type MicrosoftEntraIDOptions

= * tenantId: process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID, * }), * ] - * * ``` * * ### Notes diff --git a/packages/core/src/providers/naver.ts b/packages/core/src/providers/naver.ts index 76353bc4d8..55b98f6285 100644 --- a/packages/core/src/providers/naver.ts +++ b/packages/core/src/providers/naver.ts @@ -40,13 +40,15 @@ export interface NaverProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Naver from "@auth/core/providers/naver" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Naver({ clientId: NAVER_CLIENT_ID, clientSecret: NAVER_CLIENT_SECRET })], + * providers: [ + * Naver({ clientId: NAVER_CLIENT_ID, clientSecret: NAVER_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/netlify.ts b/packages/core/src/providers/netlify.ts index 8f16ef4c68..a566efcce8 100644 --- a/packages/core/src/providers/netlify.ts +++ b/packages/core/src/providers/netlify.ts @@ -22,13 +22,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Netlify from "@auth/core/providers/netlify" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Netlify({ clientId: NETLIFY_CLIENT_ID, clientSecret: NETLIFY_CLIENT_SECRET })], + * providers: [ + * Netlify({ + * clientId: NETLIFY_CLIENT_ID, + * clientSecret: NETLIFY_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/netsuite.ts b/packages/core/src/providers/netsuite.ts index 4d4f15aee8..54231a5669 100644 --- a/packages/core/src/providers/netsuite.ts +++ b/packages/core/src/providers/netsuite.ts @@ -65,9 +65,9 @@ export interface NetSuiteProfile { * - [NetSuite RESTLets](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4567507062.html#Tracking-RESTlet-Calls-Made-with-TBA-and-OAuth-2.0). * - [NetSuite REST Web Services](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/book_1559132836.html#SuiteTalk-REST-Web-Services-API-Guide). * - * ## Setup + * ### Setup * - * ### Disclaimer + * #### Disclaimer * By using this provider, you consent to sharing your data with NetSuite. * By using this provider we assume you comply with NetSuite's [Terms of Service](https://www.netsuite.com/portal/assets/pdf/terms_of_service.pdf) and [Privacy Policy](https://www.oracle.com/legal/privacy). * The author of this provider is not affiliated with NetSuite. Proceeding with this provider you must be a NetSuite customer and have a NetSuite account (Full access user). @@ -90,7 +90,7 @@ export interface NetSuiteProfile { * - **Save** the Integration record. * - The Integration record will be used to generate the `clientId` and `clientSecret` for the provider. **Save the generated values for later** * - * ### Callback URL + * #### Callback URL * * :::tip * When setting the Redirect URI in the Integration record, you must use the `https` protocol. @@ -107,7 +107,7 @@ export interface NetSuiteProfile { * The best bet is to use the `N/runtime` module to get the basics first. - Here is an example of a RESTlet below. Be sure to deploy and enable access to "All Roles". * ::: * - * ### Example RESTLet Callback Handler + * #### Example RESTLet Callback Handler * Be sure to deploy and use the **external** RESTLet url of any usage of the URIs. * * ```js @@ -161,7 +161,7 @@ export interface NetSuiteProfile { * * > **Note**: Above is an example of returning the basic runtime information. Be sure to create a new script record and deployment record. Upon saving the deployment record. We will get our URLs for our RESTlet. * - * ## Configuration + * ### Configuration * * ```ts * import { Auth } from "@auth/core" diff --git a/packages/core/src/providers/notion.ts b/packages/core/src/providers/notion.ts index d35ce09295..a6d9c6ccf4 100644 --- a/packages/core/src/providers/notion.ts +++ b/packages/core/src/providers/notion.ts @@ -59,27 +59,35 @@ const NOTION_API_VERSION = "2022-06-28" /** * Add Notion login to your page. * - * @example + * ### Setup * - * ```ts + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/notion + * ``` + * + * #### Configuration + *```ts * import { Auth } from "@auth/core" * import Notion from "@auth/core/providers/notion" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Notion({ clientId: NOTION_CLIENT_ID, clientSecret: NOTION_CLIENT_SECRET, redirectUri: NOTION_CLIENT_REDIRECT_URI })], + * providers: [ + * Notion({ + * clientId: NOTION_CLIENT_ID, + * clientSecret: NOTION_CLIENT_SECRET, + * redirectUri: NOTION_CLIENT_REDIRECT_URI, + * }), + * ], * }) * ``` * - * --- - * * ### Resources * - [Notion Docs](https://developers.notion.com/docs) * - [Notion Authorization Docs](https://developers.notion.com/docs/authorization) * - [Notion Integrations](https://www.notion.so/my-integrations) * - * --- - * * ### Notes * You need to select "Public Integration" on the configuration page to get an `oauth_id` and `oauth_secret`. Private integrations do not provide these details. * You must provide a `clientId` and `clientSecret` to use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens). diff --git a/packages/core/src/providers/okta.ts b/packages/core/src/providers/okta.ts index 6e88f8f37a..6d98ea7dc0 100644 --- a/packages/core/src/providers/okta.ts +++ b/packages/core/src/providers/okta.ts @@ -55,13 +55,19 @@ export interface OktaProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Okta from "@auth/core/providers/okta" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Okta({ clientId: OKTA_CLIENT_ID, clientSecret: OKTA_CLIENT_SECRET, issuer: OKTA_ISSUER })], + * providers: [ + * Okta({ + * clientId: OKTA_CLIENT_ID, + * clientSecret: OKTA_CLIENT_SECRET, + * issuer: OKTA_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/onelogin.ts b/packages/core/src/providers/onelogin.ts index f51b44e4ac..bccbc4ece6 100644 --- a/packages/core/src/providers/onelogin.ts +++ b/packages/core/src/providers/onelogin.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import OneLogin from "@auth/core/providers/onelogin" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [OneLogin({ clientId: ONELOGIN_CLIENT_ID, clientSecret: ONELOGIN_CLIENT_SECRET })], + * providers: [ + * OneLogin({ + * clientId: ONELOGIN_CLIENT_ID, + * clientSecret: ONELOGIN_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/ory-hydra.ts b/packages/core/src/providers/ory-hydra.ts index 9c93b7ef7c..25cb69a3bd 100644 --- a/packages/core/src/providers/ory-hydra.ts +++ b/packages/core/src/providers/ory-hydra.ts @@ -33,13 +33,19 @@ export interface OryHydraProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import OryHydra from "@auth/core/providers/ory-hydra" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [OryHydra({ clientId: ORY_HYDRA_CLIENT_ID, clientSecret: ORY_HYDRA_CLIENT_SECRET, issuer: ORY_HYDRA_ISSUER })], + * providers: [ + * OryHydra({ + * clientId: ORY_HYDRA_CLIENT_ID, + * clientSecret: ORY_HYDRA_CLIENT_SECRET, + * issuer: ORY_HYDRA_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/osso.ts b/packages/core/src/providers/osso.ts index f1e0e08440..90736554f8 100644 --- a/packages/core/src/providers/osso.ts +++ b/packages/core/src/providers/osso.ts @@ -21,13 +21,19 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Osso from "@auth/core/providers/osso" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Osso({ clientId: OSSO_CLIENT_ID, clientSecret: OSSO_CLIENT_SECRET, issuer: OSSO_ISSUER })], + * providers: [ + * Osso({ + * clientId: OSSO_CLIENT_ID, + * clientSecret: OSSO_CLIENT_SECRET, + * issuer: OSSO_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/osu.ts b/packages/core/src/providers/osu.ts index 2ba2360bd5..40560f906f 100644 --- a/packages/core/src/providers/osu.ts +++ b/packages/core/src/providers/osu.ts @@ -70,13 +70,15 @@ export interface OsuProfile extends OsuUserCompact, Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Osu from "@auth/core/providers/osu" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Osu({ clientId: OSU_CLIENT_ID, clientSecret: OSU_CLIENT_SECRET })], + * providers: [ + * Osu({ clientId: OSU_CLIENT_ID, clientSecret: OSU_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/passage.ts b/packages/core/src/providers/passage.ts index badb6df81b..0a1b39f746 100644 --- a/packages/core/src/providers/passage.ts +++ b/packages/core/src/providers/passage.ts @@ -45,13 +45,19 @@ export interface PassageProfile { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Passage from "@auth/core/providers/passage" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Passage({ clientId: PASSAGE_ID, clientSecret: PASSAGE_SECRET, issuer: PASSAGE_ISSUER })], + * providers: [ + * Passage({ + * clientId: PASSAGE_ID, + * clientSecret: PASSAGE_SECRET, + * issuer: PASSAGE_ISSUER, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/patreon.ts b/packages/core/src/providers/patreon.ts index 2fb76b22c0..745b2d5ca8 100644 --- a/packages/core/src/providers/patreon.ts +++ b/packages/core/src/providers/patreon.ts @@ -28,13 +28,18 @@ export interface PatreonProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Patreon from "@auth/core/providers/patreon" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Patreon({ clientId: PATREON_CLIENT_ID, clientSecret: PATREON_CLIENT_SECRET })], + * providers: [ + * Patreon({ + * clientId: PATREON_CLIENT_ID, + * clientSecret: PATREON_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/pinterest.ts b/packages/core/src/providers/pinterest.ts index 4869158274..500febbb74 100644 --- a/packages/core/src/providers/pinterest.ts +++ b/packages/core/src/providers/pinterest.ts @@ -28,13 +28,18 @@ export interface PinterestProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Pinterest from "@auth/core/providers/pinterest" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Pinterest({ clientId: PINTEREST_CLIENT_ID, clientSecret: PINTEREST_CLIENT_SECRET })], + * providers: [ + * Pinterest({ + * clientId: PINTEREST_CLIENT_ID, + * clientSecret: PINTEREST_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/pipedrive.ts b/packages/core/src/providers/pipedrive.ts index 75b66d7d16..09d257bb4e 100644 --- a/packages/core/src/providers/pipedrive.ts +++ b/packages/core/src/providers/pipedrive.ts @@ -56,13 +56,18 @@ export interface PipedriveProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Pipedrive from "@auth/core/providers/pipedrive" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Pipedrive({ clientId: PIPEDRIVE_CLIENT_ID, clientSecret: PIPEDRIVE_CLIENT_SECRET })], + * providers: [ + * Pipedrive({ + * clientId: PIPEDRIVE_CLIENT_ID, + * clientSecret: PIPEDRIVE_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/reddit.ts b/packages/core/src/providers/reddit.ts index 68befa8ff8..2edaacd99e 100644 --- a/packages/core/src/providers/reddit.ts +++ b/packages/core/src/providers/reddit.ts @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Reddit from "@auth/core/providers/reddit" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Reddit({ clientId: REDDIT_CLIENT_ID, clientSecret: REDDIT_CLIENT_SECRET })], + * providers: [ + * Reddit({ clientId: REDDIT_CLIENT_ID, clientSecret: REDDIT_CLIENT_SECRET }), + * ], * }) * ``` * @@ -51,9 +53,9 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * :::tip * * This Provider template only has a one hour access token to it and only has the "identity" scope. If you want to get a refresh token as well you must follow this: - *```js title="pages/api/auth/[...nextauth].js" + *```ts * providers: [ - * RedditProvider({ + * Reddit({ * clientId: process.env.REDDIT_CLIENT_ID, * clientSecret: process.env.REDDIT_CLIENT_SECRET, * authorization: { diff --git a/packages/core/src/providers/salesforce.ts b/packages/core/src/providers/salesforce.ts index cdd8a00ae6..27a3199277 100644 --- a/packages/core/src/providers/salesforce.ts +++ b/packages/core/src/providers/salesforce.ts @@ -28,13 +28,18 @@ export interface SalesforceProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import salesforce from "@auth/core/providers/salesforce" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [salesforce({ clientId: salesforce_CLIENT_ID, clientSecret: salesforce_CLIENT_SECRET })], + * providers: [ + * salesforce({ + * clientId: salesforce_CLIENT_ID, + * clientSecret: salesforce_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/simplelogin.ts b/packages/core/src/providers/simplelogin.ts index cbe1169640..d0eee806e6 100644 --- a/packages/core/src/providers/simplelogin.ts +++ b/packages/core/src/providers/simplelogin.ts @@ -32,7 +32,7 @@ export interface SimpleLoginProfile { * * #### Configuration *```ts - * import Auth from "@auth/core" + * import { Auth } from "@auth/core" * import SimpleLogin from "@auth/core/providers/simplelogin" * * const request = new Request(origin) diff --git a/packages/core/src/providers/slack.ts b/packages/core/src/providers/slack.ts index af1ca50ec3..e5f2549db5 100644 --- a/packages/core/src/providers/slack.ts +++ b/packages/core/src/providers/slack.ts @@ -53,13 +53,15 @@ export interface SlackProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Slack from "@auth/core/providers/slack" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Slack({ clientId: SLACK_CLIENT_ID, clientSecret: SLACK_CLIENT_SECRET })], + * providers: [ + * Slack({ clientId: SLACK_CLIENT_ID, clientSecret: SLACK_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/spotify.ts b/packages/core/src/providers/spotify.ts index ebb0bb712f..fce6235be8 100644 --- a/packages/core/src/providers/spotify.ts +++ b/packages/core/src/providers/spotify.ts @@ -32,13 +32,18 @@ export interface SpotifyProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Spotify from "@auth/core/providers/spotify" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Spotify({ clientId: SPOTIFY_CLIENT_ID, clientSecret: SPOTIFY_CLIENT_SECRET })], + * providers: [ + * Spotify({ + * clientId: SPOTIFY_CLIENT_ID, + * clientSecret: SPOTIFY_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/strava.ts b/packages/core/src/providers/strava.ts index 63f440991a..e429166fb9 100644 --- a/packages/core/src/providers/strava.ts +++ b/packages/core/src/providers/strava.ts @@ -28,13 +28,15 @@ export interface StravaProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Strava from "@auth/core/providers/strava" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Strava({ clientId: STRAVA_CLIENT_ID, clientSecret: STRAVA_CLIENT_SECRET })], + * providers: [ + * Strava({ clientId: STRAVA_CLIENT_ID, clientSecret: STRAVA_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/tiktok.ts b/packages/core/src/providers/tiktok.ts index 098a8664e5..78322779e2 100644 --- a/packages/core/src/providers/tiktok.ts +++ b/packages/core/src/providers/tiktok.ts @@ -137,13 +137,15 @@ export interface TiktokProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import TikTok from "@auth/core/providers/tiktok" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [TikTok({ clientId: TIKTOK_CLIENT_KEY, clientSecret: TIKTOK_CLIENT_SECRET })], + * providers: [ + * TikTok({ clientId: TIKTOK_CLIENT_KEY, clientSecret: TIKTOK_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/todoist.ts b/packages/core/src/providers/todoist.ts index 5123e9e240..3bc58b3c0c 100644 --- a/packages/core/src/providers/todoist.ts +++ b/packages/core/src/providers/todoist.ts @@ -31,13 +31,18 @@ interface TodoistProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Todoist from "@auth/core/providers/todoist" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Todoist({ clientId: TODOIST_CLIENT_ID, clientSecret: TODOIST_CLIENT_SECRET })], + * providers: [ + * Todoist({ + * clientId: TODOIST_CLIENT_ID, + * clientSecret: TODOIST_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/trakt.ts b/packages/core/src/providers/trakt.ts index c0e191a4e4..1462b8818b 100644 --- a/packages/core/src/providers/trakt.ts +++ b/packages/core/src/providers/trakt.ts @@ -36,13 +36,15 @@ export interface TraktUser extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Trakt from "@auth/core/providers/trakt" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Trakt({ clientId: TRAKT_CLIENT_ID, clientSecret: TRAKT_CLIENT_SECRET })], + * providers: [ + * Trakt({ clientId: TRAKT_CLIENT_ID, clientSecret: TRAKT_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/twitch.ts b/packages/core/src/providers/twitch.ts index 5a9b67ae22..4846d27010 100644 --- a/packages/core/src/providers/twitch.ts +++ b/packages/core/src/providers/twitch.ts @@ -28,13 +28,15 @@ export interface TwitchProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Twitch from "@auth/core/providers/twitch" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Twitch({ clientId: TWITCH_CLIENT_ID, clientSecret: TWITCH_CLIENT_SECRET })], + * providers: [ + * Twitch({ clientId: TWITCH_CLIENT_ID, clientSecret: TWITCH_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/twitter.ts b/packages/core/src/providers/twitter.ts index 669c26d21e..dd1b3cf776 100644 --- a/packages/core/src/providers/twitter.ts +++ b/packages/core/src/providers/twitter.ts @@ -113,13 +113,18 @@ export interface TwitterProfile { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Twitter from "@auth/core/providers/twitter" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Twitter({ clientId: TWITTER_CLIENT_ID, clientSecret: TWITTER_CLIENT_SECRET })], + * providers: [ + * Twitter({ + * clientId: TWITTER_CLIENT_ID, + * clientSecret: TWITTER_CLIENT_SECRET, + * }), + * ], * }) * ``` * @@ -129,8 +134,8 @@ export interface TwitterProfile { * * ## OAuth 2 * Twitter supports OAuth 2, which is currently opt-in. To enable it, simply add version: "2.0" to your Provider configuration: - * ```js title="pages/api/auth/[...nextauth].js" - * TwitterProvider({ + * ```ts + * Twitter({ * clientId: process.env.TWITTER_ID, * clientSecret: process.env.TWITTER_SECRET, * version: "2.0", // opt-in to Twitter OAuth 2.0 diff --git a/packages/core/src/providers/united-effects.ts b/packages/core/src/providers/united-effects.ts index fad09eea9b..734a982ce0 100644 --- a/packages/core/src/providers/united-effects.ts +++ b/packages/core/src/providers/united-effects.ts @@ -24,13 +24,15 @@ export interface UnitedEffectsProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import UnitedEffects from "@auth/core/providers/united-effects" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [UnitedEffects({ clientId: UE_CLIENT_ID, clientSecret: UE_CLIENT_SECRET })], + * providers: [ + * UnitedEffects({ clientId: UE_CLIENT_ID, clientSecret: UE_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/vk.ts b/packages/core/src/providers/vk.ts index a0d2b8bde8..e4b5620b24 100644 --- a/packages/core/src/providers/vk.ts +++ b/packages/core/src/providers/vk.ts @@ -302,8 +302,8 @@ export interface VkProfile { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import VK from "@auth/core/providers/vk" * * const request = new Request(origin) @@ -333,10 +333,10 @@ export interface VkProfile { * * By default the provider uses 5.126 version of the API. See https://vk.com/dev/versions for more info. * If you want to use a different version, you can pass it to provider's options object: - * ```js title="pages/api/auth/[...nextauth].js" + * ```ts * const apiVersion = "5.126" * providers: [ - * VkProvider({ + * Vk({ * accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, * requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, * authorizationUrl: diff --git a/packages/core/src/providers/webex.ts b/packages/core/src/providers/webex.ts index dfc4f9401f..fa1ee94457 100755 --- a/packages/core/src/providers/webex.ts +++ b/packages/core/src/providers/webex.ts @@ -35,13 +35,15 @@ export interface WebexProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Webex from "@auth/core/providers/webex" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Webex({ clientId: WEBEX_CLIENT_ID, clientSecret: WEBEX_CLIENT_SECRET })], + * providers: [ + * Webex({ clientId: WEBEX_CLIENT_ID, clientSecret: WEBEX_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/wikimedia.ts b/packages/core/src/providers/wikimedia.ts index 67e8b3c3c5..7043ff7ddb 100644 --- a/packages/core/src/providers/wikimedia.ts +++ b/packages/core/src/providers/wikimedia.ts @@ -174,13 +174,18 @@ export interface WikimediaProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Wikimedia from "@auth/core/providers/wikimedia" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Wikimedia({ clientId: WIKIMEDIA_CLIENT_ID, clientSecret: WIKIMEDIA_CLIENT_SECRET })], + * providers: [ + * Wikimedia({ + * clientId: WIKIMEDIA_CLIENT_ID, + * clientSecret: WIKIMEDIA_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/wordpress.ts b/packages/core/src/providers/wordpress.ts index 398a5ca334..e44dbe50c7 100644 --- a/packages/core/src/providers/wordpress.ts +++ b/packages/core/src/providers/wordpress.ts @@ -21,13 +21,18 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import WordPress from "@auth/core/providers/wordpress" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [WordPress({ clientId: WORKPRESS_CLIENT_ID, clientSecret: WORKPRESS_CLIENT_SECRET })], + * providers: [ + * WordPress({ + * clientId: WORKPRESS_CLIENT_ID, + * clientSecret: WORKPRESS_CLIENT_SECRET, + * }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/workos.ts b/packages/core/src/providers/workos.ts index fc600254ed..45bbdd2412 100644 --- a/packages/core/src/providers/workos.ts +++ b/packages/core/src/providers/workos.ts @@ -42,13 +42,19 @@ export interface WorkOSProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import WorkOS from "@auth/core/providers/workos" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [WorkOS({ clientId: WORKOS_CLIENT_ID, clientSecret: WORKOS_CLIENT_SECRET, issuer: WORKOS_ISSUER })], + * providers: [ + * WorkOS({ + * clientId: WORKOS_CLIENT_ID, + * clientSecret: WORKOS_CLIENT_SECRET, + * issuer: WORKOS_ISSUER, + * }), + * ], * }) * ``` * @@ -67,7 +73,7 @@ export interface WorkOSProfile extends Record { * In order to sign a user in using WorkOS, we need to specify which WorkOS Connection to use. * A common way to do this is to collect the user's email address and extract the domain. This can be done using a custom login page. * To add a custom login page, you can use the `pages` option: - * ```js title="pages/api/auth/[...nextauth].js" + * ```ts * pages: { * signIn: "/auth/signin", * } diff --git a/packages/core/src/providers/yandex.ts b/packages/core/src/providers/yandex.ts index 08c11e390b..a477051d3e 100644 --- a/packages/core/src/providers/yandex.ts +++ b/packages/core/src/providers/yandex.ts @@ -84,17 +84,25 @@ export interface YandexProfile { } /** - * Add Yandex login to your page + * Add Yandex login to your page. * - * @example + * ### Setup * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/yandex + * ``` + * + * #### Configuration * ```ts * import { Auth } from "@auth/core" * import Yandex from "@auth/core/providers/yandex" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Yandex({ clientId: YANDEX_CLIENT_ID, clientSecret: YANDEX_CLIENT_SECRET })], + * providers: [ + * Yandex({ clientId: YANDEX_CLIENT_ID, clientSecret: YANDEX_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/zitadel.ts b/packages/core/src/providers/zitadel.ts index d535da7c9a..c8f55c616b 100644 --- a/packages/core/src/providers/zitadel.ts +++ b/packages/core/src/providers/zitadel.ts @@ -50,13 +50,18 @@ export interface ZitadelProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import ZITADEL from "@auth/core/providers/zitadel" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [ZITADEL({ clientId: ZITADEL_CLIENT_ID, clientSecret: ZITADEL_CLIENT_SECRET })], + * providers: [ + * ZITADEL({ + * clientId: ZITADEL_CLIENT_ID, + * clientSecret: ZITADEL_CLIENT_SECRET, + * }), + * ], * }) * ``` * @@ -84,7 +89,7 @@ export interface ZitadelProfile extends Record { * :::tip * * ZITADEL also returns a email_verified boolean property in the profile. You can use this property to restrict access to people with verified accounts. - * ```ts title=pages/api/auth/[...nextauth].js + * ```ts * const options = { * ... * callbacks: { diff --git a/packages/core/src/providers/zoho.ts b/packages/core/src/providers/zoho.ts index 417de4eaae..113afd206f 100644 --- a/packages/core/src/providers/zoho.ts +++ b/packages/core/src/providers/zoho.ts @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js" * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import ZOHO from "@auth/core/providers/zoho" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [ZOHO({ clientId: ZOHO_CLIENT_ID, clientSecret: ZOHO_CLIENT_SECRET })], + * providers: [ + * ZOHO({ clientId: ZOHO_CLIENT_ID, clientSecret: ZOHO_CLIENT_SECRET }), + * ], * }) * ``` * diff --git a/packages/core/src/providers/zoom.ts b/packages/core/src/providers/zoom.ts index 8e366ec01c..fdf9500d0a 100644 --- a/packages/core/src/providers/zoom.ts +++ b/packages/core/src/providers/zoom.ts @@ -54,13 +54,15 @@ export interface ZoomProfile extends Record { * ``` * * #### Configuration - *```js - * import Auth from "@auth/core" + *```ts + * import { Auth } from "@auth/core" * import Zoom from "@auth/core/providers/zoom" * * const request = new Request(origin) * const response = await Auth(request, { - * providers: [Zoom({ clientId: ZOOM_CLIENT_ID, clientSecret: ZOOM_CLIENT_SECRET })], + * providers: [ + * Zoom({ clientId: ZOOM_CLIENT_ID, clientSecret: ZOOM_CLIENT_SECRET }), + * ], * }) * ``` *