### Zoho Provider Setup Source: https://authjs.dev/reference/core/providers/zoho Example of initializing the Auth.js instance with the Zoho provider. ```typescript 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 }), ], }) ``` -------------------------------- ### Logto Provider Setup Source: https://authjs.dev/reference/core/providers/logto Instructions and code examples for setting up the Logto provider in Auth.js. ```APIDOC ## default() ``` function default(options): OIDCConfig ``` ### Setup #### Callback URL ``` https://example.com/api/auth/callback/logto ``` #### Configuration ```javascript import { Auth } from "@auth/core" import Logto from "@auth/core/providers/logto" const request = new Request(origin) const response = await Auth(request, { providers: [ Logto({ clientId: LOGTO_ID, clientSecret: LOGTO_SECRET, issuer: LOGTO_ISSUER }), ], }) ``` ### Resources * Logto Auth.js quickstart * Integrate Logto in your application ### Notes The Logto provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider. By default, Auth.js assumes that the Logto provider is based on the OIDC spec ### Parameters Parameter| Type ---|--- `options`| `OIDCUserConfig`<`LogtoProfile`> ### Returns `OIDCConfig`<`LogtoProfile`> ``` -------------------------------- ### QwikAuth Setup with GitHub Provider Source: https://authjs.dev/reference/qwik Example of setting up QwikAuth in a Qwik application using the GitHub provider. ```typescript import { QwikAuth } from "@auth/qwik" import GitHub from "@auth/qwik/providers/github" export const { onRequest, useSession, useSignIn, useSignOut } = QwikAuth$(() => ({ providers: [GitHub] })) ``` -------------------------------- ### Spotify Authentication Setup Source: https://authjs.dev/reference/core/providers/spotify Provides instructions and code examples for setting up the Spotify provider in Auth.js. ```APIDOC ## Spotify Authentication ### Setup #### Callback URL ``` https://example.com/api/auth/callback/spotify ``` #### Configuration ```javascript 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, }), ], }) ``` ### Resources * Spotify OAuth documentation * Spotify app console ### Notes By default, Auth.js assumes that the Spotify provider is based on the OAuth 2 specification. To override the defaults for your use case, check out customizing a built-in OAuth provider. ``` -------------------------------- ### GitLab Authentication Setup Source: https://authjs.dev/reference/core/providers/gitlab Instructions and code examples for setting up GitLab authentication using Auth.js. ```APIDOC ## default() Add GitLab login to your page. ### Setup #### Callback URL ``` https://example.com/api/auth/callback/gitlab ``` #### Configuration ```javascript 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 }), ], }) ``` ### Resources * GitLab OAuth documentation ### Notes By default, Auth.js assumes that the GitLab provider is based on the OAuth 2 specification. 💡 Enable the `read_user` option in scope if you want to save the users email address on sign up. 💡 The GitLab provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider. ****Disclaimer**** If you think you found a bug in the default configuration, you can open an issue. Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions. ### Type Parameters Type Parameter --- `P` _extends_ `GitLabProfile` ### Parameters Parameter| Type ---|--- `options`| `OAuthUserConfig

& { baseUrl: string | URL; }` ### Returns `OAuthConfig

` ``` -------------------------------- ### Twitch Provider Setup Source: https://authjs.dev/reference/core/providers/twitch Instructions and code examples for setting up the Twitch provider in Auth.js. ```APIDOC ## default() ### Description Adds Twitch login functionality to your application using Auth.js. ### Setup #### Callback URL `https://example.com/api/auth/callback/twitch` #### Configuration ```javascript 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 }), ], }) ``` ### Resources - Twitch app documentation ### Notes - Auth.js assumes the Twitch provider is based on the Open ID Connect specification. - To override default configurations, refer to customizing a built-in OAuth provider. - Ensure the redirect URL `http:///api/auth/callback/twitch` is added to your Twitch application console. ### Parameters - **config** (`OIDCUserConfig`) - Configuration object for the Twitch provider. ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/unstorage-adapter Instructions on how to install the @auth/unstorage-adapter using various package managers. ```APIDOC ## Installation Install the @auth/unstorage-adapter using your preferred package manager: ### npm ```bash npm install unstorage @auth/unstorage-adapter ``` ### pnpm ```bash pnpm add unstorage @auth/unstorage-adapter ``` ### yarn ```bash yarn add unstorage @auth/unstorage-adapter ``` ### bun ```bash bun add unstorage @auth/unstorage-adapter ``` ``` -------------------------------- ### Install @auth/solid-start Source: https://authjs.dev/reference/solid-start Commands to install the required Auth.js core and SolidStart integration packages. ```bash npm install @auth/core @auth/solid-start ``` ```bash pnpm add @auth/core @auth/solid-start ``` ```bash yarn add @auth/core @auth/solid-start ``` ```bash bun add @auth/core @auth/solid-start ``` -------------------------------- ### Qwik Credentials Provider Setup Source: https://authjs.dev/getting-started/authentication/credentials Configure the Credentials provider for Qwik applications. This example demonstrates defining input fields and the `authorize` function for user verification. ```typescript import { QwikAuth$ } from "@auth/qwik" import Credentials from "@auth/qwik/providers/credentials" export const { onRequest, useSession, useSignIn, useSignOut } = QwikAuth$( () => ({ providers: [ Credentials({ credentials: { email: { label: "Email" }, password: { label: "Password", type: "password" }, }, async authorize(credentials) { const response = await getUserFromDb(credentials) if (!response.ok) return null return (await response.json()) ?? null }, }), ], }) ) ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/neon-adapter Instructions for installing the @auth/neon-adapter using various package managers. ```APIDOC ## Installation ### npm ```bash npm install next-auth @auth/neon-adapter ``` ### pnpm ```bash pnpm add next-auth @auth/neon-adapter ``` ### yarn ```bash yarn add next-auth @auth/neon-adapter ``` ### bun ```bash bun add next-auth @auth/neon-adapter ``` ``` -------------------------------- ### Install Prisma Adapter with bun Source: https://authjs.dev/reference/prisma-adapter Installs the @auth/prisma-adapter and Prisma client using bun. Also installs Prisma as a development dependency. ```bash bun add @prisma/client @auth/prisma-adapter bun add prisma --dev ``` -------------------------------- ### Roblox Provider Setup Source: https://authjs.dev/reference/core/providers/roblox Instructions and code examples for setting up the Roblox provider in Auth.js. ```APIDOC ## default() Add Roblox login to your page. ### Setup #### Callback URL ``` https://example.com/api/auth/callback/roblox ``` #### Configuration ```javascript import { Auth } from "@auth/core" import Roblox from "@auth/providers/roblox" const request = new Request(origin) const response = await Auth(request, { providers: [ Roblox({ clientId: AUTH_ROBLOX_ID, clientSecret: AUTH_ROBLOX_SECRET, }), ], }) ``` ### Resources * Roblox OAuth documentation * Roblox OAuth apps ### Parameters Parameter| Type ---|--- `options`| `OIDCUserConfig` ### Returns `OIDCConfig` ``` -------------------------------- ### Passkey Provider Setup and Configuration Source: https://authjs.dev/reference/core/providers/passkey Instructions on how to install the necessary dependencies and configure the Passkey provider within your Auth.js application. ```APIDOC ## Passkey Provider Setup ### Description Integrate Passkey login functionality into your application using the built-in Auth.js Passkey provider. ### Installation Install the required peer dependency: **npm** ``` npm install @simplewebauthn/browser@9.0.1 ``` **pnpm** ``` pnpm add @simplewebauthn/browser@9.0.1 ``` **yarn** ``` yarn add @simplewebauthn/browser@9.0.1 ``` **bun** ``` bun add @simplewebauthn/browser@9.0.1 ``` ### Configuration Example ```javascript import { Auth } from "@auth/core" import Passkey from "@auth/core/providers/passkey" const request = new Request(origin) const response = await Auth(request, { providers: [ Passkey({ // Optional: Override default Passkey provider configuration // See customizing a built-in WebAuthn provider for details. }), ], }) ``` ### Resources * [SimpleWebAuthn - Server side](https://github.com/MasterKale/simplewebauthn) * [SimpleWebAuthn - Client side](https://github.com/MasterKale/simplewebauthn) * [Passkeys.dev - Intro](https://passkeys.dev/) * [Passkeys.dev - Specifications](https://passkeys.dev/) * [Source code](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/passkey.ts) ### Notes The Passkey provider is an extension of the WebAuthn provider, offering default values optimized for Passkey support. While these defaults can be overridden, be aware that deviating from standard Passkey configurations might affect authenticator recognition. Auth.js adheres strictly to the WebAuthn specification. For issues related to non-compliance with the spec, we may not pursue a resolution. For further assistance, please use the Discussions forum. ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/surrealdb-adapter Instructions for installing the @auth/surrealdb-adapter package using various package managers. ```APIDOC ## Installation ### npm ```bash npm install @auth/surrealdb-adapter surrealdb.js ``` ### pnpm ```bash pnpm add @auth/surrealdb-adapter surrealdb.js ``` ### yarn ```bash yarn add @auth/surrealdb-adapter surrealdb.js ``` ### bun ```bash bun add @auth/surrealdb-adapter surrealdb.js ``` ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/sequelize-adapter Commands to install the necessary dependencies for the Sequelize adapter. ```APIDOC ## Installation To use the Sequelize adapter, install the required packages: ```bash npm install next-auth @auth/sequelize-adapter sequelize ``` ``` -------------------------------- ### WeChat Provider Setup and Configuration Source: https://authjs.dev/reference/core/providers/wechat Instructions and code examples for setting up the WeChat provider in Auth.js. ```APIDOC ## default() Adds WeChat login to your page and enables requests to WeChat APIs. ### Setup #### Callback URL `https://example.com/api/auth/callback/wechat` #### Configuration ```javascript import { Auth } from "@auth/core" import WeChat from "@auth/core/providers/wechat" const request = new Request(origin) const response = await Auth(request, { providers: [WeChat({ clientId: AUTH_WECHAT_APP_ID, clientSecret: AUTH_WECHAT_APP_SECRET, platformType: "OfficialAccount", })], }) ``` ### Parameters - **options** (`OAuthUserConfig` & { `platformType`: "OfficialAccount" | "WebsiteApp"; }) - Configuration options for the WeChat provider, including `clientId`, `clientSecret`, and `platformType`. ``` -------------------------------- ### Install @auth/azure-tables-adapter Source: https://authjs.dev/reference/azure-tables-adapter Commands to install the adapter and next-auth using various package managers. ```bash npm install next-auth @auth/azure-tables-adapter ``` ```bash pnpm add next-auth @auth/azure-tables-adapter ``` ```bash yarn add next-auth @auth/azure-tables-adapter ``` ```bash bun add next-auth @auth/azure-tables-adapter ``` -------------------------------- ### Install Prisma Adapter with npm Source: https://authjs.dev/reference/prisma-adapter Installs the @auth/prisma-adapter and Prisma client using npm. Also installs Prisma as a development dependency. ```bash npm install @prisma/client @auth/prisma-adapter npm install prisma --save-dev ``` -------------------------------- ### Auth.js GitHub OAuth Provider Setup Source: https://authjs.dev/getting-started/migrate-to-better-auth Example of setting up the GitHub OAuth provider with Auth.js. ```typescript import NextAuth from "next-auth" import GitHub from "next-auth/providers/github" export const { handlers, signIn, signOut, auth } = NextAuth({ providers: [GitHub], }) ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/nextjs Instructions for installing NextAuth.js using different package managers. ```APIDOC ## Installation ### npm ```npm npm install next-auth@beta ``` ### pnpm ```pnpm pnpm add next-auth@beta ``` ### yarn ```yarn yarn add next-auth@beta ``` ### bun ```bun bun add next-auth@beta ``` ``` -------------------------------- ### Install @auth/neon-adapter with bun Source: https://authjs.dev/reference/neon-adapter Use this command to install the adapter using bun. ```bash bun add next-auth @auth/neon-adapter ``` -------------------------------- ### Install PostgreSQL Client with bun Source: https://authjs.dev/getting-started/adapters/kysely Install the PostgreSQL client and its types for use with Kysely. ```bash bun add pg bun add --dev @types/pg ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/dgraph-adapter Instructions for installing the @auth/dgraph-adapter package using various package managers. ```APIDOC ## Installation ### npm ```npm install next-auth @auth/dgraph-adapter``` ### pnpm ```pnpm add next-auth @auth/dgraph-adapter``` ### yarn ```yarn add next-auth @auth/dgraph-adapter``` ### bun ```bun add next-auth @auth/dgraph-adapter``` ``` -------------------------------- ### Install @auth/hasura-adapter Source: https://authjs.dev/reference/hasura-adapter Installation commands for various package managers. ```bash npm install @auth/hasura-adapter ``` ```bash pnpm add @auth/hasura-adapter ``` ```bash yarn add @auth/hasura-adapter ``` ```bash bun add @auth/hasura-adapter ``` -------------------------------- ### Install PostgreSQL Client with npm Source: https://authjs.dev/getting-started/adapters/kysely Install the PostgreSQL client and its types for use with Kysely. ```bash npm install pg npm install --save-dev @types/pg ``` -------------------------------- ### Clone Next.js Example App Source: https://authjs.dev/guides/configuring-resend Clone the example repository to get started with Auth.js and Next.js. ```bash git clone https://github.com/nextauthjs/next-auth-example.git && cd next-auth-example ``` -------------------------------- ### Install @auth/neon-adapter with npm Source: https://authjs.dev/reference/neon-adapter Use this command to install the adapter using npm. ```bash npm install next-auth @auth/neon-adapter ``` -------------------------------- ### Install SvelteKit Auth.js with bun Source: https://authjs.dev/getting-started/installation Install the SvelteKit package for Auth.js using bun. ```bash bun add @auth/sveltekit ``` -------------------------------- ### Frontegg Configuration Example Source: https://authjs.dev/getting-started/providers/frontegg Example of setting up Frontegg environment variables in a .env.local file. ```env # Environments > Your environment > Env settings AUTH_FRONTEGG_ID="" # Environments > Your environment > Env settings AUTH_FRONTEGG_SECRET="" # Environments > Your environment > Env settings > Domains > Domain name AUTH_FRONTEGG_ISSUER="" ``` -------------------------------- ### Auth.js Server-side Get Session Source: https://authjs.dev/getting-started/migrate-to-better-auth Example of getting the current session on the server-side with Auth.js. ```typescript import { auth } from "@/lib/auth"; const session = await auth() ``` -------------------------------- ### Install Dgraph Adapter with bun Source: https://authjs.dev/getting-started/adapters/dgraph Install the Dgraph adapter package using bun. ```bash bun add @auth/dgraph-adapter ``` -------------------------------- ### Install @auth/core Source: https://authjs.dev/reference/core/jwt Installation commands for the @auth/core package using various package managers. ```bash npm install @auth/core ``` ```bash pnpm add @auth/core ``` ```bash yarn add @auth/core ``` ```bash bun add @auth/core ``` -------------------------------- ### Unsecure Dgraph Schema Example Source: https://authjs.dev/getting-started/adapters/dgraph Example schema for an unsecure Dgraph setup, suitable for development. This schema does not require a jwtSecret. ```graphql type Account { id: ID type: String provider: String @search(by: [hash]) providerAccountId: String @search(by: [hash]) refreshToken: String expires_at: Int64 accessToken: String token_type: String refresh_token: String access_token: String scope: String id_token: String session_state: String user: User @hasInverse(field: "accounts") } type Session { id: ID expires: DateTime sessionToken: String @search(by: [hash]) user: User @hasInverse(field: "sessions") } type User { id: ID name: String email: String @search(by: [hash]) emailVerified: DateTime image: String accounts: [Account] @hasInverse(field: "user") sessions: [Session] @hasInverse(field: "user") } type VerificationToken { id: ID identifier: String @search(by: [hash]) token: String @search(by: [hash]) expires: DateTime } ``` -------------------------------- ### Setup New Framework Integration Source: https://authjs.dev/guides/creating-a-framework-integration Use this command to generate the necessary files for a new framework integration. Replace `` with the target framework's name. ```bash npm setup-fw-integration ``` ```bash yarn setup-fw-integration ``` ```bash bun setup-fw-integration ``` -------------------------------- ### Better Auth Server-side Get Session Source: https://authjs.dev/getting-started/migrate-to-better-auth Example of getting the current session on the server-side using Better Auth's `auth.api.getSession`, including passing headers. ```typescript import { auth } from "@/lib/auth"; import { headers } from "next/headers"; const session = await auth.api.getSession({ headers: await headers(), }) ``` -------------------------------- ### Install Prisma Adapter with yarn Source: https://authjs.dev/reference/prisma-adapter Installs the @auth/prisma-adapter and Prisma client using yarn. Also installs Prisma as a development dependency. ```bash yarn add @prisma/client @auth/prisma-adapter yarn add prisma --dev ``` -------------------------------- ### Install Dependencies with bun Source: https://authjs.dev/reference/sequelize-adapter Install the necessary packages for the Sequelize adapter using bun. ```bash bun add next-auth @auth/sequelize-adapter sequelize ``` -------------------------------- ### Installation Source: https://authjs.dev/reference/typeorm-adapter Instructions for installing the @auth/typeorm-adapter package using various package managers. ```APIDOC ## Installation ### npm ``` npm install @auth/typeorm-adapter typeorm ``` ### pnpm ``` pnpm add @auth/typeorm-adapter typeorm ``` ### yarn ``` yarn add @auth/typeorm-adapter typeorm ``` ### bun ``` bun add @auth/typeorm-adapter typeorm ``` ``` -------------------------------- ### Start Development Server Source: https://authjs.dev/guides/configuring-resend Commands to start the local development server using npm, pnpm, yarn, or bun. ```bash npm run dev ``` ```bash pnpm run dev ``` ```bash yarn dev ``` ```bash bun run dev ``` -------------------------------- ### Install Prisma Client and Auth.js Adapter with bun Source: https://authjs.dev/getting-started/adapters/prisma Install the necessary Prisma packages and the Auth.js Prisma adapter using bun. ```bash bun add @prisma/client @prisma/extension-accelerate @auth/prisma-adapter bun add prisma --dev ``` -------------------------------- ### Install @auth/pg-adapter Source: https://authjs.dev/reference/pg-adapter Commands to install the necessary dependencies for using the PostgreSQL adapter with Auth.js. ```bash npm install next-auth @auth/pg-adapter pg ``` ```bash pnpm add next-auth @auth/pg-adapter pg ``` ```bash yarn add next-auth @auth/pg-adapter pg ``` ```bash bun add next-auth @auth/pg-adapter pg ``` -------------------------------- ### Initialize WeChat Provider Source: https://authjs.dev/reference/core/providers/wechat Example setup for integrating the WeChat provider into the Auth.js configuration. ```typescript import { Auth } from "@auth/core" import WeChat from "@auth/core/providers/wechat" const request = new Request(origin) const response = await Auth(request, { providers: [WeChat({ clientId: AUTH_WECHAT_APP_ID, clientSecret: AUTH_WECHAT_APP_SECRET, platformType: "OfficialAccount", })], }) ``` -------------------------------- ### Install TypeORM Adapter with bun Source: https://authjs.dev/getting-started/adapters/typeorm Installs the TypeORM adapter and TypeORM using bun. ```bash bun add @auth/typeorm-adapter typeorm ``` -------------------------------- ### Install @auth/xata-adapter Source: https://authjs.dev/reference/xata-adapter Install the adapter package using your preferred package manager. ```shell npm install @auth/xata-adapter ``` ```shell pnpm add @auth/xata-adapter ``` ```shell yarn add @auth/xata-adapter ``` ```shell bun add @auth/xata-adapter ``` -------------------------------- ### Install Prisma Client and Auth.js Adapter with npm Source: https://authjs.dev/getting-started/adapters/prisma Install the necessary Prisma packages and the Auth.js Prisma adapter using npm. ```bash npm install @prisma/client @prisma/extension-accelerate @auth/prisma-adapter npm install prisma --save-dev ``` -------------------------------- ### Install Next.js Auth.js with bun Source: https://authjs.dev/getting-started/installation Install the Next.js package for Auth.js using bun. ```bash bun add next-auth@beta ``` -------------------------------- ### Install @auth/neon-adapter with pnpm Source: https://authjs.dev/reference/neon-adapter Use this command to install the adapter using pnpm. ```bash pnpm add next-auth @auth/neon-adapter ``` -------------------------------- ### Configure Concept2 Provider Source: https://authjs.dev/reference/core/providers/concept2 Example setup for integrating the Concept2 provider into an Auth.js instance. ```typescript import { Auth } from "@auth/core" import Concept2 from "@auth/core/providers/concept2" const request = new Request(origin) const response = await Auth(request, { providers: [ Concept2({ clientId: CONCEPT2_CLIENT_ID, clientSecret: CONCEPT2_CLIENT_SECRET }), ], }) ``` -------------------------------- ### Install NextAuth.js with bun Source: https://authjs.dev/reference/nextjs Use this command to install the beta version of NextAuth.js using bun. ```bash bun add next-auth@beta ``` -------------------------------- ### DuendeIdentityServer6 Provider Setup Source: https://authjs.dev/reference/core/providers/duende-identity-server6 Guides on how to add and configure the DuendeIdentityServer6 provider in your Auth.js application. ```APIDOC ## DuendeIdentityServer6 Provider Setup ### Description Integrates Duende IdentityServer6 as an authentication provider in Auth.js. ### Method `default(options)` ### Endpoint N/A (This is a provider configuration function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Configuration ```javascript 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, }), ], }) ``` ### Callback URL `https://example.com/api/auth/callback/duende-identity-server6` ### Demo Configuration ```javascript import DuendeIdentityServer6 from "@auth/core/providers/duende-identity-server6" providers: [ DuendeIdentityServer6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com", }) ] ``` ### Notes - Auth.js assumes DuendeIdentityServer6 provider is based on OpenID Connect. - Customization of default provider settings is possible via `OAuthUserConfig`. - Issues related to provider non-compliance with specifications should be reported to the provider maintainers. ``` -------------------------------- ### Initialize Prisma with Prisma Postgres Source: https://authjs.dev/getting-started/adapters/prisma Initialize Prisma with a Prisma Postgres database, setting up the schema and client output directory. ```bash npx prisma init --db --output ./src/generated/prisma ``` -------------------------------- ### Install @auth/neon-adapter with yarn Source: https://authjs.dev/reference/neon-adapter Use this command to install the adapter using yarn. ```bash yarn add next-auth @auth/neon-adapter ``` -------------------------------- ### Install SvelteKit Auth.js with npm Source: https://authjs.dev/getting-started/installation Install the SvelteKit package for Auth.js using npm. ```bash npm install @auth/sveltekit ``` -------------------------------- ### Install Neon Adapter with bun Source: https://authjs.dev/getting-started/adapters/neon Install the Neon adapter and the Neon serverless driver using bun. ```bash bun add @auth/neon-adapter @neondatabase/serverless ``` -------------------------------- ### Install SvelteKit Auth.js with pnpm Source: https://authjs.dev/getting-started/installation Install the SvelteKit package for Auth.js using pnpm. ```bash pnpm add @auth/sveltekit ``` -------------------------------- ### Install Hasura Adapter with bun Source: https://authjs.dev/getting-started/adapters/hasura Install the Hasura adapter package using bun. ```bash bun add @auth/hasura-adapter ``` -------------------------------- ### Install NextAuth.js with npm Source: https://authjs.dev/reference/nextjs Use this command to install the beta version of NextAuth.js using npm. ```bash npm install next-auth@beta ``` -------------------------------- ### Concept2 Provider Setup Source: https://authjs.dev/reference/core/providers/concept2 Instructions and code examples for setting up the Concept2 provider in your Auth.js application. ```APIDOC ## Default Concept2 Provider Configuration ### Description Adds Concept2 login functionality to your application using Auth.js. ### Method `default(options)` ### Parameters - **options** (OAuthUserConfig) - Configuration options for the Concept2 provider. ### Returns `OAuthConfig` - The configuration object for the Concept2 provider. ### Setup #### Callback URL ``` https://example.com/api/auth/callback/concept2 ``` #### Configuration Example ```javascript import { Auth } from "@auth/core" import Concept2 from "@auth/core/providers/concept2" const request = new Request(origin) const response = await Auth(request, { providers: [ Concept2({ clientId: CONCEPT2_CLIENT_ID, clientSecret: CONCEPT2_CLIENT_SECRET }), ], }) ``` ### Resources - Concept2 OAuth documentation ### Notes - Auth.js assumes the Concept2 provider is based on the OAuth 2 specification. - The provider comes with default configurations that can be overridden. - Auth.js adheres strictly to the specification; deviations by the provider may not be resolved. ``` -------------------------------- ### Install PostgreSQL Client with pnpm Source: https://authjs.dev/getting-started/adapters/kysely Install the PostgreSQL client and its types for use with Kysely. ```bash pnpm add pg pnpm add --save-dev @types/pg ``` -------------------------------- ### WorkOS Provider Setup and Configuration Source: https://authjs.dev/reference/core/providers/workos Guides on how to add and configure the WorkOS provider in your Auth.js application. ```APIDOC ## default() Adds WorkOS login functionality to your application. ### Setup #### Callback URL ``` https://example.com/api/auth/callback/workos ``` #### Configuration ```javascript 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, }), ], }) ``` ### Resources * WorkOS SSO OAuth documentation ### Notes * Auth.js assumes the WorkOS provider is based on the OAuth 2.0 specification. * WorkOS acts as a bridge to multiple SSO providers, requiring additional configuration for authentication. * To sign in users with WorkOS, you must specify a WorkOS Connection. This can be done dynamically using a custom login page. #### Custom Login Page Example (`pages/auth/signin.js`) ```javascript import { useState } from "react" import { getProviders, signIn } from "next-auth/react" export default function SignIn({ providers }) { const [email, setEmail] = useState("") return ( <> {Object.values(providers).map((provider) => { if (provider.id === "workos") { return (

setEmail(event.target.value)} />
) } return (
) })} ) } export async function getServerSideProps(context) { const providers = await getProviders() return { props: { providers }, } } ``` ### Type Parameters * **`P`** _extends_ `WorkOSProfile` ### Parameters * **`options`** (`OAuthUserConfig

` & { `connection`: `string`; }): Configuration options for the WorkOS provider, including the `connection` ID. ### Returns * `OAuthConfig

`: The WorkOS OAuth configuration object. ``` -------------------------------- ### Install PostgreSQL Client with yarn Source: https://authjs.dev/getting-started/adapters/kysely Install the PostgreSQL client and its types for use with Kysely. ```bash yarn add pg yarn add --dev @types/pg ``` -------------------------------- ### Strava Provider Setup Source: https://authjs.dev/reference/core/providers/strava Guides on how to add and configure the Strava OAuth provider in your Auth.js application. ```APIDOC ## default() ### Description Adds Strava login functionality to your application using Auth.js. ### Setup #### Callback URL `https://example.com/api/auth/callback/strava` #### Configuration ```javascript 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 }), ], }) ``` ### Parameters - **options** (OAuthUserConfig

) - Configuration options for the Strava provider. `P` extends `StravaProfile`. ### Returns - `OAuthConfig

` - The OAuth configuration object for Auth.js. ``` -------------------------------- ### Install Neon Adapter with npm Source: https://authjs.dev/getting-started/adapters/neon Install the Neon adapter and the Neon serverless driver using npm. ```bash npm install @auth/neon-adapter @neondatabase/serverless ``` -------------------------------- ### OryHydra Provider Setup Source: https://authjs.dev/reference/core/providers/ory-hydra Guides on how to set up and configure the Ory Hydra provider in your Auth.js application. ```APIDOC ## OryHydra Provider Configuration ### Description Integrates Ory Hydra as an authentication provider in Auth.js. ### Setup #### Callback URL ``` https://example.com/api/auth/callback/hydra ``` #### Configuration ```javascript 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, }), ], }) ``` ### Parameters - **options** (OIDCUserConfig

) - Configuration options for the Ory Hydra provider. - **clientId** (string) - Required - The client ID for your Ory Hydra application. - **clientSecret** (string) - Required - The client secret for your Ory Hydra application. - **issuer** (string) - Required - The issuer URL of your Ory Hydra instance. ### Returns `OIDCConfig

` - The OIDC configuration object for the Ory Hydra provider. ### Resources - Ory Hydra documentation: [Link to Ory Hydra docs] ### Notes - Auth.js assumes the Ory Hydra provider follows the OpenID Connect specification. - Default configurations can be overridden by customizing the built-in OAuth provider. - Auth.js adheres strictly to the specification; deviations by the provider may not be resolved. ``` -------------------------------- ### Configure Ory Hydra Provider Source: https://authjs.dev/reference/core/providers/ory-hydra Example setup for integrating the Ory Hydra provider into an Auth.js instance. ```typescript 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, }), ], }) ``` -------------------------------- ### Beyond Identity Provider Setup Source: https://authjs.dev/reference/core/providers/beyondidentity Example implementation of the Beyond Identity provider within an Auth.js configuration. ```typescript 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, }), ], }) ``` -------------------------------- ### Install Prisma Client and Auth.js Adapter with yarn Source: https://authjs.dev/getting-started/adapters/prisma Install the necessary Prisma packages and the Auth.js Prisma adapter using yarn. ```bash yarn add @prisma/client @prisma/extension-accelerate @auth/prisma-adapter yarn add prisma --dev ``` -------------------------------- ### LinkedIn Provider Setup and Configuration Source: https://authjs.dev/reference/core/providers/linkedin Instructions and code examples for setting up the LinkedIn provider within your Auth.js application. ```APIDOC ## Adding LinkedIn Login ### Description Integrates LinkedIn as an OAuth provider for user authentication with Auth.js. ### Setup #### Callback URL `https://example.com/api/auth/callback/linkedin` #### Configuration ```javascript 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, }), ], }) ``` ### Resources - LinkedIn OAuth documentation - LinkedIn app console ### Notes - Auth.js assumes the LinkedIn provider follows the OIDC specification by default. - For custom configurations, refer to the documentation on customizing built-in OAuth providers. - Issues related to provider non-compliance with specifications should be reported to the provider directly. ### Type Parameters `P` extends `LinkedInProfile` ### Parameters - **options** (`OIDCUserConfig

`) - Configuration options for the LinkedIn provider. ``` -------------------------------- ### Auth.js Route Handler Setup Source: https://authjs.dev/getting-started/migrate-to-better-auth Example of setting up a route handler for Auth.js, typically used for API endpoints. ```typescript import { handlers } from "@/lib/auth" export const { GET, POST } = handlers ``` -------------------------------- ### Auth.js Client-side Use Session Hook Source: https://authjs.dev/getting-started/migrate-to-better-auth Example of using the `useSession` hook to get session data on the client-side with Auth.js. ```typescript "use client" import { useSession } from "next-auth/react" const { data, status, update } = useSession() ``` -------------------------------- ### Install Azure Tables Adapter with bun Source: https://authjs.dev/getting-started/adapters/azure-tables Install the Azure Tables adapter package using bun. ```bash bun add @auth/azure-tables-adapter ``` -------------------------------- ### Install Kysely Adapter with bun Source: https://authjs.dev/getting-started/adapters/kysely Install the Kysely adapter and its peer dependency Kysely using bun. ```bash bun add kysely @auth/kysely-adapter ``` -------------------------------- ### Express Configuration with Nextcloud Provider Source: https://authjs.dev/getting-started/providers/nextcloud Configure the Nextcloud provider for an Express application using ExpressAuth. This example demonstrates middleware setup. ```javascript import { ExpressAuth } from "@auth/express" import Nextcloud from "@auth/express/providers/nextcloud" app.use( "/auth/*", ExpressAuth({ providers: [ Nextcloud({ clientId: AUTH_NEXTCLOUD_ID, clientSecret: AUTH_NEXTCLOUD_SECRET, issuer: AUTH_NEXTCLOUD_ISSUER, }), ], }) ) ``` -------------------------------- ### Initiate SAML Sign-In with Tenant and Product Parameters Source: https://authjs.dev/getting-started/providers/boxyhq-saml Example of initiating a BoxyHQ SAML sign-in flow from a Next.js client-side component, passing tenant and product identifiers. ```javascript import { signIn } from "next-auth/react"; // Map your users's email to a tenant and product const tenant = email.split("@")[1]; const product = 'my_awesome_product';