diff --git a/.github/labeler.yml b/.github/labeler.yml
index 775bed2140..55b024b632 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -2,23 +2,15 @@ test:
- test/**/*
- types/tests/**/*
-documentation:
- - www/**/*
- - ./**/*.md
-
providers:
- src/providers/**/*
- - www/docs/configuration/providers.md
- test/integration/**/*
adapters:
- src/adapters/**/*
- - www/docs/schemas/adapters.md
databases:
- - www/docs/schemas/*.md
- test/docker/databases/**/*
- - www/docs/configuration/databases.md
- test/fixtures/**/*
core:
@@ -29,11 +21,9 @@ style:
client:
- src/client/**/*
- - www/docs/getting-started/client.md
pages:
- src/server/pages/**/*
- - www/docs/configuration/pages.md
TypeScript:
- types/**/*
diff --git a/.gitignore b/.gitignore
index 9c9a3ce2f1..396d639f2f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,12 +20,10 @@ node_modules
.next
/build
/dist
-/www/build
# Generated files
.docusaurus
.cache-loader
-www/providers.json
/internals
/providers
/types/providers/*
diff --git a/package.json b/package.json
index b1a7358f43..97a5c43a8d 100644
--- a/package.json
+++ b/package.json
@@ -40,8 +40,7 @@
"prepublishOnly": "npm run build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
- "version:pr": "node ./config/version-pr",
- "website": "cd www && npm run start"
+ "version:pr": "node ./config/version-pr"
},
"files": [
"dist",
@@ -135,7 +134,6 @@
"test",
"next-env.d.ts",
"types",
- "www",
".next",
"dist"
],
diff --git a/www/docs/adapters/dynamodb.md b/www/docs/adapters/dynamodb.md
deleted file mode 100644
index 6fdf5fb6be..0000000000
--- a/www/docs/adapters/dynamodb.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-id: dynamodb
-title: DynamoDB Adapter
----
-
-# DynamoDB
-
-This is the AWS DynamoDB Adapter for next-auth. This package can only be used in conjunction with the primary next-auth package. It is not a standalone package.
-
-You need a table with a partition key `pk` and a sort key `sk`. Your table also needs a global secondary index named `GSI1` with `GSI1PK` as partition key and `GSI1SK` as sorting key. You can set whatever you want as the table name and the billing method.
-
-You can find the full schema in the table structure section below.
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/dynamodb-adapter`
-
-```js
-npm install next-auth @next-auth/dynamodb-adapter
-```
-
-2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object.
-
-You need to pass `DocumentClient` instance from `aws-sdk` to the adapter.
-The default table name is `next-auth`, but you can customise that by passing `{ tableName: 'your-table-name' }` as the second parameter in the adapter.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import AWS from "aws-sdk";
-import NextAuth from "next-auth";
-import Providers from "next-auth/providers";
-import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter"
-
-AWS.config.update({
- accessKeyId: process.env.NEXT_AUTH_AWS_ACCESS_KEY,
- secretAccessKey: process.env.NEXT_AUTH_AWS_SECRET_KEY,
- region: process.env.NEXT_AUTH_AWS_REGION,
-});
-
-export default NextAuth({
- // Configure one or more authentication providers
- providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_ID,
- clientSecret: process.env.GITHUB_SECRET,
- }),
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- }),
- // ...add more providers here
- ],
- adapter: DynamoDBAdapter(
- new AWS.DynamoDB.DocumentClient()
- ),
- ...
-});
-```
-
-(AWS secrets start with `NEXT_AUTH_` in order to not conflict with [Vercel's reserved environment variables](https://vercel.com/docs/environment-variables#reserved-environment-variables).)
-
-## Schema
-
-The table respects the single table design pattern. This has many advantages:
-
-- Only one table to manage, monitor and provision.
-- Querying relations is faster than with multi-table schemas (for eg. retrieving all sessions for a user).
-- Only one table needs to be replicated, if you want to go multi-region.
-
-Here is a schema of the table :
-
-![DynamoDB Table](https://i.imgur.com/hGZtWDq.png)
diff --git a/www/docs/adapters/fauna.md b/www/docs/adapters/fauna.md
deleted file mode 100644
index 0fc4cd346f..0000000000
--- a/www/docs/adapters/fauna.md
+++ /dev/null
@@ -1,86 +0,0 @@
----
-id: fauna
-title: FaunaDB Adapter
----
-
-# FaunaDB
-
-This is the Fauna Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-You can find the Fauna schema and seed information in the docs at [next-auth.js.org/adapters/fauna](https://next-auth.js.org/adapters/fauna).
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/fauna-adapter`
-
-```js
-npm install next-auth @next-auth/fauna-adapter
-```
-
-2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import * as Fauna from "faunadb"
-import { FaunaAdapter } from "@next-auth/fauna-adapter"
-
-const client = new Fauna.Client({
- secret: "secret",
- scheme: "http",
- domain: "localhost",
- port: 8443,
-})
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: FaunaAdapter({ faunaClient: client})
- ...
-})
-```
-
-## Schema
-
-Run the following commands inside of the `Shell` tab in the Fauna dashboard to setup the appropriate collections and indexes.
-
-```javascript
-CreateCollection({ name: "accounts" })
-CreateCollection({ name: "sessions" })
-CreateCollection({ name: "users" })
-CreateCollection({ name: "verification_requests" })
-CreateIndex({
- name: "account_by_provider_account_id",
- source: Collection("accounts"),
- unique: true,
- terms: [
- { field: ["data", "providerId"] },
- { field: ["data", "providerAccountId"] },
- ],
-})
-CreateIndex({
- name: "session_by_token",
- source: Collection("sessions"),
- unique: true,
- terms: [{ field: ["data", "sessionToken"] }],
-})
-CreateIndex({
- name: "user_by_email",
- source: Collection("users"),
- unique: true,
- terms: [{ field: ["data", "email"] }],
-})
-CreateIndex({
- name: "verification_request_by_token_and_identifier",
- source: Collection("verification_requests"),
- unique: true,
- terms: [{ field: ["data", "token"] }, { field: ["data", "identifier"] }],
-})
-```
diff --git a/www/docs/adapters/firebase.md b/www/docs/adapters/firebase.md
deleted file mode 100644
index 772cf443d4..0000000000
--- a/www/docs/adapters/firebase.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-id: firebase
-title: Firebase Adapter
----
-
-# Firebase
-
-This is the Firebase Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/firebase-adapter`
-
-```js
-npm install next-auth @next-auth/firebase-adapter
-```
-
-2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { FirebaseAdapter } from "@next-auth/firebase-adapter"
-
-import firebase from "firebase/app"
-import "firebase/firestore"
-
-const firestore = (
- firebase.apps[0] ?? firebase.initializeApp(/* your config */)
-).firestore()
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: FirebaseAdapter(firestore),
- ...
-})
-```
-
-## Options
-
-When initializing the firestore adapter, you must pass in the firebase config object with the details from your project. More details on how to obtain that config object can be found [here](https://support.google.com/firebase/answer/7015592).
-
-An example firebase config looks like this:
-
-```js
-const firebaseConfig = {
- apiKey: "AIzaSyDOCAbC123dEf456GhI789jKl01-MnO",
- authDomain: "myapp-project-123.firebaseapp.com",
- databaseURL: "https://myapp-project-123.firebaseio.com",
- projectId: "myapp-project-123",
- storageBucket: "myapp-project-123.appspot.com",
- messagingSenderId: "65211879809",
- appId: "1:65211879909:web:3ae38ef1cdcb2e01fe5f0c",
- measurementId: "G-8GSGZQ44ST",
-}
-```
-
-See [firebase.google.com/docs/web/setup](https://firebase.google.com/docs/web/setup) for more details.
-
-:::tip **From Firebase**
-
-**Caution**: We do not recommend manually modifying an app's Firebase config file or object. If you initialize an app with invalid or missing values for any of these required "Firebase options", then your end users may experience serious issues.
-
-For open source projects, we generally do not recommend including the app's Firebase config file or object in source control because, in most cases, your users should create their own Firebase projects and point their apps to their own Firebase resources (via their own Firebase config file or object).
-:::
diff --git a/www/docs/adapters/models.md b/www/docs/adapters/models.md
deleted file mode 100644
index 7dc7362244..0000000000
--- a/www/docs/adapters/models.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-id: models
-title: Models
----
-
-NextAuth.js can be used with any database. Models tell you what structures NextAuth.js expects from your database. Models will vary slightly depending on which adapter you use, but in general will look something like this.
-
-![v4 Schema](/img/nextauth_v4_schema.png)
-
-More information about each Model / Table can be found below.
-
-:::note
-You can [create your own adapter](/tutorials/creating-a-database-adapter) if you want to use NextAuth.js with a database that is not supported out of the box, or you have to change fields on any of the models.
-:::
-
----
-
-## User
-
-The User model is for information such as the user's name and email address.
-
-Email address is optional, but if one is specified for a User then it must be unique.
-
-:::note
-If a user first signs in with OAuth then their email address is automatically populated using the one from their OAuth profile, if the OAuth provider returns one.
-
-This provides a way to contact users and for users to maintain access to their account and sign in using email in the event they are unable to sign in with the OAuth provider in future (if the [Email Provider](/providers/email) is configured).
-:::
-
-## Account
-
-The Account model is for information about OAuth accounts associated with a User.
-
-A single User can have multiple Accounts, but each Account can only have one User.
-
-Linking Accounts to Users happen automatically, only when they have the same e-mail address, and the user is currently signed in. Check the [FAQ](/faq#security) for more information why this is a requirement.
-
-## Session
-
-The Session model is used for database sessions. It is not used if JSON Web Tokens are enabled. Keep in mind, that you can use a database to persist Users and Accounts, and still use JWT for sessions. See the [`session.jwt`](/configuration/options#session) option.
-
-A single User can have multiple Sessions, each Session can only have one User.
-
-## Verification Token
-
-The Verification Token model is used to store tokens for passwordless sign in.
-
-A single User can have multiple open Verification Tokens (e.g. to sign in to different devices).
-
-It has been designed to be extendable for other verification purposes in the future (e.g. 2FA / short codes).
-
-:::note
-NextAuth.js makes sure that every token is usable only once, and by default has a short lifetime. If your user did not manage to finish the sign-in flow in time (15 minutes by default), they will have to start the sign-in process again.
-:::
diff --git a/www/docs/adapters/overview.md b/www/docs/adapters/overview.md
deleted file mode 100644
index 5a76443cac..0000000000
--- a/www/docs/adapters/overview.md
+++ /dev/null
@@ -1,46 +0,0 @@
----
-id: overview
-title: Overview
----
-
-An **Adapter** in NextAuth.js connects your application to whatever database or backend system you want to use to store data for users, their accounts, sessions, etc. Adapters are optional, unless you need to persist user information in your own database, or you wnt implement certain flows. The [Email Provider](/providers/email) requires an adapter to be able to save [Verification Tokens](/adapters/models#verification-token).
-
-:::tip
-When using a database, you can still use JWT for session handling for fast access. See the [`session.jwt`](/configuration/options#session) option. Read about the trade-offs of JWT in this [FAQ section](/faq#json-web-tokens).
-:::
-
-The official adapters can be found in their own repository under [`nextauthjs/adapters`](https://github.com/nextauthjs/adapters).
-
-There you can find the following adapters:
-
-- [`typeorm-legacy`](./typeorm/typeorm-overview)
-- [`prisma`](./prisma)
-- [`fauna`](./fauna)
-- [`dynamodb`](./dynamodb)
-- [`firebase`](./firebase)
-- [`pouchdb`](./pouchdb)
-
-## Custom Adapter
-
-See the tutorial for [creating a database Adapter](/tutorials/creating-a-database-adapter) for more information on how to create a custom Adapter.
-
-:::tip
-If you would like to see a new adapter in the official repository, please [open a PR](https://github.com/nextauthjs/adapters) and we will help you.
-:::
-
-### Editor integration
-
-When writing your own custom Adapter in plain JavaScript, note that you can use **JSDoc** to get helpful editor hints and auto-completion like so:
-
-```js
-/** @return { import("next-auth/adapters").Adapter } */
-function MyAdapter() {
- return {
- // your adapter methods here
- }
-}
-```
-
-:::note
-This will work in code editors with a strong TypeScript integration like VSCode or WebStorm. It might not work if you're using more lightweight editors like VIM or Atom.
-:::
diff --git a/www/docs/adapters/pouchdb.md b/www/docs/adapters/pouchdb.md
deleted file mode 100644
index d0bc555c56..0000000000
--- a/www/docs/adapters/pouchdb.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-id: pouchdb
-title: PouchDB Adapter
----
-
-# PouchDB
-
-This is the PouchDB Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-Depending on your architecture you can use PouchDB's http adapter to reach any database compliant with the CouchDB protocol (CouchDB, Cloudant, ...) or use any other PouchDB compatible adapter (leveldb, in-memory, ...)
-
-## Getting Started
-
-> **Prerequesite**: Your PouchDB instance MUST provide the `pouchdb-find` plugin since it is used internally by the adapter to build and manage indexes
-
-1. Install `next-auth` and `@next-auth/pouchdb-adapter`
-
-```js
-npm install next-auth @next-auth/pouchdb-adapter
-```
-
-2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { PouchDBAdapter } from "@next-auth/pouchdb-adapter"
-import PouchDB from "pouchdb"
-
-// Setup your PouchDB instance and database
-PouchDB.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter
- .plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin
-
-const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" })
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: PouchDBAdapter(pouchdb),
- // ...
-})
-```
-
-## Advanced
-
-### Memory-First Caching Strategy
-
-If you need to boost your authentication layer performance, you may use PouchDB's powerful sync features and various adapters, to build a memory-first caching strategy.
-
-Use an in-memory PouchDB as your main authentication database, and synchronize it with any other persisted PouchDB. You may do a one way, one-off replication at startup from the persisted PouchDB into the in-memory PouchDB, then two-way, continuous, retriable sync.
-
-This will most likely not increase performance much in a serverless environment due to various reasons such as concurrency, function startup time increases, etc.
-
-For more details, please see https://pouchdb.com/api.html#sync
diff --git a/www/docs/adapters/prisma.md b/www/docs/adapters/prisma.md
deleted file mode 100644
index 8a25e8e6a4..0000000000
--- a/www/docs/adapters/prisma.md
+++ /dev/null
@@ -1,120 +0,0 @@
----
-id: prisma
-title: Prisma Adapter
----
-
-# Prisma
-
-To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate `@next-auth/prisma-adapter` package:
-
-```
-npm install @prisma/client @next-auth/prisma-adapter
-npm install prisma --save-dev
-```
-
-Configure your NextAuth.js to use the Prisma Adapter:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { PrismaAdapter } from "@next-auth/prisma-adapter"
-import { PrismaClient } from "@prisma/client"
-
-const prisma = new PrismaClient()
-
-export default NextAuth({
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- }),
- ],
- adapter: PrismaAdapter(prisma),
-})
-```
-
-:::tip
-While Prisma includes an experimental feature in the migration command that is able to generate SQL from a schema, creating tables and columns using the provided SQL is currently recommended instead as SQL schemas automatically generated by Prisma may differ from the recommended schemas.
-:::
-Schema for the Prisma Adapter (`@next-auth/prisma-adapter`)
-
-## Setup
-
-You need to use at least Prisma 2.26.0. Create a schema file in `prisma/schema.prisma` similar to this one:
-
-```json title="schema.prisma"
-datasource db {
- provider = "sqlite"
- url = "file:./dev.db"
-}
-
-generator client {
- provider = "prisma-client-js"
- previewFeatures = ["referentialActions"]
-}
-
-model Account {
- id String @id @default(cuid())
- userId String
- type String
- provider String
- providerAccountId String
- refresh_token String?
- access_token String?
- expires_at Int?
- token_type String?
- scope String?
- id_token String?
- session_state String?
- oauth_token_secret String?
- oauth_token String?
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@unique([provider, providerAccountId])
-}
-
-model Session {
- id String @id @default(cuid())
- sessionToken String @unique
- userId String
- expires DateTime
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-}
-
-model User {
- id String @id @default(cuid())
- name String?
- email String? @unique
- emailVerified DateTime?
- image String?
- accounts Account[]
- sessions Session[]
-}
-
-model VerificationToken {
- identifier String
- token String @unique
- expires DateTime
-
- @@unique([identifier, token])
-}
-```
-
-### Generate Client
-
-Once you have saved your schema, use the Prisma CLI to generate the Prisma Client:
-
-```
-npx prisma generate
-```
-
-To configure you database to use the new schema (i.e. create tables and columns) use the `prisma migrate` command:
-
-```
-npx prisma migrate dev
-```
-
-To generate a schema in this way with the above example code, you will need to specify your database connection string in the environment variable `DATABASE_URL`. You can do this by setting it in a `.env` file at the root of your project.
-
-As this feature is experimental in Prisma, it is behind a feature flag. You should check your database schema manually after using this option. See the [Prisma documentation](https://www.prisma.io/docs/) for information on how to use `prisma migrate`.
\ No newline at end of file
diff --git a/www/docs/adapters/typeorm/mongodb.md b/www/docs/adapters/typeorm/mongodb.md
deleted file mode 100644
index 5bf0abaef4..0000000000
--- a/www/docs/adapters/typeorm/mongodb.md
+++ /dev/null
@@ -1,22 +0,0 @@
----
-id: mongodb
-title: MongoDB
----
-
-MongoDB is a document database and does not use schemas in the same way as most RDBMS databases.
-
-**In MongoDB as collections and indexes are created automatically.**
-
-## Objects in MongoDB
-
-Objects stored in MongoDB use similar datatypes to SQL, with some differences:
-
-1. ID fields are of type `ObjectID` rather than type `int`.
-
-2. All collection names and property names use `camelCase` rather than `snake_case`.
-
-3. All timestamps are stored as `ISODate()` in MongoDB and all date/time values are stored in UTC.
-
-4. A sparse index is used on the User `email` property to allow it to be optional, while still enforcing uniqueness if it is specified.
-
-This is functionally equivalent to the ANSI SQL behaviour for a `unique` but `nullable` property.
diff --git a/www/docs/adapters/typeorm/mssql.md b/www/docs/adapters/typeorm/mssql.md
deleted file mode 100644
index 387261c56d..0000000000
--- a/www/docs/adapters/typeorm/mssql.md
+++ /dev/null
@@ -1,88 +0,0 @@
----
-id: mssql
-title: Microsoft SQL Server
----
-
-Schema for a Microsoft SQL Server (mssql) database.
-
-:::note
-When using a Microsoft SQL Server database with the default adapter (TypeORM) all properties of type `timestamp` are transformed to `datetime`.
-
-This transform is also applied to any properties of type `timestamp` when using custom models.
-:::
-
-```sql
-CREATE TABLE accounts
- (
- id int IDENTITY(1,1) NOT NULL,
- compound_id varchar(255) NOT NULL,
- user_id int NOT NULL,
- provider_type varchar(255) NOT NULL,
- provider_id varchar(255) NOT NULL,
- provider_account_id varchar(255) NOT NULL,
- refresh_token text NULL,
- access_token text NULL,
- access_token_expires datetime NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE sessions
- (
- id int IDENTITY(1,1) NOT NULL,
- user_id int NOT NULL,
- expires datetime NOT NULL,
- session_token varchar(255) NOT NULL,
- access_token varchar(255) NOT NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE users
- (
- id int IDENTITY(1,1) NOT NULL,
- name varchar(255) NULL,
- email varchar(255) NULL,
- email_verified datetime NULL,
- image varchar(255) NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE verification_requests
- (
- id int IDENTITY(1,1) NOT NULL,
- identifier varchar(255) NOT NULL,
- token varchar(255) NOT NULL,
- expires datetime NOT NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE UNIQUE INDEX compound_id
- ON accounts(compound_id);
-
-CREATE INDEX provider_account_id
- ON accounts(provider_account_id);
-
-CREATE INDEX provider_id
- ON accounts(provider_id);
-
-CREATE INDEX user_id
- ON accounts(user_id);
-
-CREATE UNIQUE INDEX session_token
- ON sessions(session_token);
-
-CREATE UNIQUE INDEX access_token
- ON sessions(access_token);
-
-CREATE UNIQUE INDEX email
- ON users(email);
-
-CREATE UNIQUE INDEX token
- ON verification_requests(token);
-```
-
-When using NextAuth.js with SQL Server for the first time, run NextAuth.js once against your database with `?synchronize=true` on the connection string and export the schema that is created.
-:::
diff --git a/www/docs/adapters/typeorm/mysql.md b/www/docs/adapters/typeorm/mysql.md
deleted file mode 100644
index cac75a0bad..0000000000
--- a/www/docs/adapters/typeorm/mysql.md
+++ /dev/null
@@ -1,80 +0,0 @@
----
-id: mysql
-title: MySQL
----
-
-Schema for a MySQL database.
-
-:::note
-When using a MySQL database with the default adapter (TypeORM) all timestamp columns use 6 digits of precision (unless another value for `precision` is specified in the schema) and the timezone is set to `Z` (aka Zulu Time / UTC) and all timestamps are stored in UTC.
-:::
-
-```sql
-CREATE TABLE accounts (
- id SERIAL,
- compound_id VARCHAR(255) NOT NULL,
- user_id INTEGER NOT NULL,
- `type` VARCHAR(255) NOT NULL,
- provider VARCHAR(255) NOT NULL,
- provider_account_id VARCHAR(255) NOT NULL,
- refresh_token TEXT,
- access_token TEXT,
- access_token_expires TIMESTAMP,
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-)
-
-CREATE TABLE sessions (
- id SERIAL,
- user_id INTEGER NOT NULL,
- expires TIMESTAMP NOT NULL,
- session_token VARCHAR(255) NOT NULL,
- access_token VARCHAR(255) NOT NULL,
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-)
-
-CREATE TABLE users (
- id SERIAL,
- name VARCHAR(255),
- email VARCHAR(255),
- email_verified TIMESTAMP,
- image TEXT,
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-)
-
-CREATE TABLE verification_tokens (
- id SERIAL,
- identifier VARCHAR(255) NOT NULL,
- token VARCHAR(255) NOT NULL,
- expires TIMESTAMP NOT NULL,
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-)
-
-CREATE UNIQUE INDEX compound_id
- ON accounts(compound_id);
-
-CREATE INDEX provider_account_id
- ON accounts(provider_account_id);
-
-CREATE INDEX user_id
- ON accounts(user_id);
-
-CREATE UNIQUE INDEX session_token
- ON sessions(session_token);
-
-CREATE UNIQUE INDEX access_token
- ON sessions(access_token);
-
-CREATE UNIQUE INDEX email
- ON users(email);
-
-CREATE UNIQUE INDEX token
- ON verification_requests(token);
-```
diff --git a/www/docs/adapters/typeorm/overview.md b/www/docs/adapters/typeorm/overview.md
deleted file mode 100644
index 3c19a70cf6..0000000000
--- a/www/docs/adapters/typeorm/overview.md
+++ /dev/null
@@ -1,21 +0,0 @@
----
-id: typeorm-overview
-title: Overview
----
-
-## TypeORM Adapter
-
-### Database Schemas
-
-Configure your database by creating the tables and columns to match the schema expected by NextAuth.js.
-
-- [MySQL Schema](./mysql)
-- [Postgres Schema](./postgres)
-- [Microsoft SQL Server Schema](./mssql)
-- [MongoDB](./mongodb)
-
-The tutorial [Custom models with TypeORM](/tutorials/typeorm-custom-models) explains how to extend the built in models and schemas used by the TypeORM Adapter. You can use these models in your own code.
-
-:::tip
-The `synchronize` option in TypeORM will generate SQL that exactly matches the documented schemas for MySQL and Postgres. This will automatically apply any changes it finds in the entity model, therefore it **should not be enabled against production databases** as it may cause data loss if the configured schema does not match the expected schema!
-:::
diff --git a/www/docs/adapters/typeorm/postgres.md b/www/docs/adapters/typeorm/postgres.md
deleted file mode 100644
index 6eeba543e6..0000000000
--- a/www/docs/adapters/typeorm/postgres.md
+++ /dev/null
@@ -1,70 +0,0 @@
----
-id: postgres
-title: Postgres
----
-
-Schema for a Postgres database.
-
-:::note
-When using a Postgres database with the default adapter (TypeORM) all properties of type `timestamp` are transformed to `timestamp with time zone`/`timestamptz` and all timestamps are stored in UTC.
-
-This transform is also applied to any properties of type `timestamp` when using custom models.
-:::
-
-```sql
-CREATE TABLE accounts (
- id SERIAL,
- compound_id VARCHAR(255) NOT NULL,
- user_id INTEGER NOT NULL,
- type VARCHAR(255) NOT NULL,
- provider VARCHAR(255) NOT NULL,
- provider_account_id VARCHAR(255) NOT NULL,
- refresh_token TEXT,
- access_token TEXT,
- access_token_expires TIMESTAMPTZ,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-);
-
-CREATE TABLE sessions (
- id SERIAL,
- user_id INTEGER NOT NULL,
- expires TIMESTAMPTZ NOT NULL,
- session_token VARCHAR(255) NOT NULL,
- access_token VARCHAR(255) NOT NULL,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-);
-
-CREATE TABLE users (
- id SERIAL,
- name VARCHAR(255),
- email VARCHAR(255),
- email_verified TIMESTAMPTZ,
- image TEXT,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-);
-
-CREATE TABLE verification_tokens (
- id SERIAL,
- identifier VARCHAR(255) NOT NULL,
- token VARCHAR(255) NOT NULL,
- expires TIMESTAMPTZ NOT NULL,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
-);
-
-CREATE UNIQUE INDEX compound_id ON accounts(compound_id);
-CREATE INDEX provider_account_id ON accounts(provider_account_id);
-CREATE INDEX user_id ON accounts(user_id);
-CREATE UNIQUE INDEX session_token ON sessions(session_token);
-CREATE UNIQUE INDEX access_token ON sessions(access_token);
-CREATE UNIQUE INDEX email ON users(email);
-CREATE UNIQUE INDEX token ON verification_tokens(token);
-
-```
diff --git a/www/docs/configuration/callbacks.md b/www/docs/configuration/callbacks.md
deleted file mode 100644
index 704592450a..0000000000
--- a/www/docs/configuration/callbacks.md
+++ /dev/null
@@ -1,169 +0,0 @@
----
-id: callbacks
-title: Callbacks
----
-
-Callbacks are **asynchronous** functions you can use to control what happens when an action is performed.
-
-Callbacks are extremely powerful, especially in scenarios involving JSON Web Tokens as they allow you to implement access controls without a database and to integrate with external databases or APIs.
-
-:::tip
-If you want to pass data such as an Access Token or User ID to the browser when using JSON Web Tokens, you can persist the data in the token when the `jwt` callback is called, then pass the data through to the browser in the `session` callback.
-:::
-
-You can specify a handler for any of the callbacks below.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
- callbacks: {
- async signIn({ user, account, profile, email, credentials }) {
- return true
- },
- async redirect({ url, baseUrl }) {
- return baseUrl
- },
- async session({ session, user, token }) {
- return session
- },
- async jwt({ token, user, account, profile, isNewUser }) {
- return token
- }
-...
-}
-```
-
-The documentation below shows how to implement each callback, their default behaviour and an example of what the response for each callback should be. Note that configuration options and authentication providers you are using can impact the values passed to the callbacks.
-
-## Sign in callback
-
-Use the `signIn()` callback to control if a user is allowed to sign in.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- async signIn({ user, account, profile, email, credentials }) {
- const isAllowedToSignIn = true
- if (isAllowedToSignIn) {
- return true
- } else {
- // Return false to display a default error message
- return false
- // Or you can return a URL to redirect to:
- // return '/unauthorized'
- }
- }
-}
-...
-```
-
-- When using the **Email Provider** the `signIn()` callback is triggered both when the user makes a **Verification Request** (before they are sent email with a link that will allow them to sign in) and again _after_ they activate the link in the sign in email.
-
- Email accounts do not have profiles in the same way OAuth accounts do. On the first call during email sign in the `email` object will include a property `verificationRequest: true` to indicate it is being triggered in the verification request flow. When the callback is invoked _after_ a user has clicked on a sign in link, this property will not be present.
-
- You can check for the `verificationRequest` property to avoid sending emails to addresses or domains on a blocklist (or to only explicitly generate them for email address in an allow list).
-
-* When using the **Credentials Provider** the `user` object is the response returned from the `authorize` callback and the `profile` object is the raw body of the `HTTP POST` submission.
-
-:::note
-When using NextAuth.js with a database, the User object will be either a user object from the database (including the User ID) if the user has signed in before or a simpler prototype user object (i.e. name, email, image) for users who have not signed in before.
-
-When using NextAuth.js without a database, the user object will always be a prototype user object, with information extracted from the profile.
-:::
-
-:::note
-Redirects returned by this callback cancel the authentication flow. Only redirect to error pages that, for example, tell the user why they're not allowed to sign in.
-
-To redirect to a page after a successful sign in, please use [the `callbackUrl` option](/getting-started/client#specifying-a-callbackurl) or [the redirect callback](/configuration/callbacks#redirect-callback).
-:::
-
-## Redirect callback
-
-The redirect callback is called anytime the user is redirected to a callback URL (e.g. on signin or signout).
-
-By default only URLs on the same URL as the site are allowed, you can use the redirect callback to customise that behaviour.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- redirect({ url, baseUrl }) {
- return url.startsWith(baseUrl) ? url : baseUrl
- }
-}
-...
-```
-
-:::note
-The redirect callback may be invoked more than once in the same flow.
-:::
-
-## JWT callback
-
-This callback is called whenever a JSON Web Token is created (i.e. at sign
-in) or updated (i.e whenever a session is accessed in the client). The returned value will be [signed and optionally encrypted](/configuration/options#jwt), and it is stored in a cookie.
-
-Requests to `/api/auth/signin`, `/api/auth/session` and calls to `getSession()`, `useSession()` will invoke this function, but only if you are using a [JWT session](/configuration/options#session). This method is not invoked when you persist sessions in a database.
-
-- As with database persisted session expiry times, token expiry time is extended whenever a session is active.
-- The arguments _user_, _account_, _profile_ and _isNewUser_ are only passed the first time this callback is called on a new session, after the user signs in. In subsequent calls, only `token` will be available.
-
-The contents _user_, _account_, _profile_ and _isNewUser_ will vary depending on the provider and on if you are using a database or not. You can persist data such as User ID, OAuth Access Token in this token. To make it available in the browser, check out the [`session()` callback](#session-callback) as well.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- async jwt({ token, account }) {
- // Persist the OAuth access_token to the token right after signin
- if (account) {
- token.accessToken = account.access_token
- }
- return token
- }
-}
-...
-```
-
-:::tip
-Use an if branch to check for the existence of parameters (apart from `token`). If they exist, this means that the callback is being invoked for the first time (i.e. the user is being signed in). This is a good place to persist additional data like an `access_token` in the JWT. Subsequent invocations will only contain the `token` parameter.
-:::
-
-:::warning
-NextAuth.js does not limit how much data you can store in a JSON Web Token, however a ~**4096 byte limit** per cookie is commonly imposed by browsers.
-
-If you need to persist a large amount of data, you will need to persist it elsewhere (e.g. in a database). A common solution is to store a key in the cookie that can be used to look up the remaining data in the database, for example, in the `session()` callback. Opt into database persisted sessions by setting [`session: {jwt: false}`](/configuration/options#session).
-:::
-
-## Session callback
-
-The session callback is called whenever a session is checked. By default, only a subset of the token is returned for increased security. If you want to make something available you added to the token through the `jwt()` callback, you have to explicitly forward it here to make it available to the client.
-
-e.g. `getSession()`, `useSession()`, `/api/auth/session`
-
-- When using database sessions, the User object is passed as an argument.
-- When using JSON Web Tokens for sessions, the JWT payload is provided instead.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- async session({ session, token, user }) {
- // Send properties to the client, like an access_token from a provider.
- session.accessToken = token.accessToken
- return session
- }
-}
-...
-```
-
-If you're using TypeScript, you will want to [augment the session type](/getting-started/typescript#module-augmentation).
-
-:::tip
-When using JSON Web Tokens the `jwt()` callback is invoked before the `session()` callback, so anything you add to the
-JSON Web Token will be immediately available in the session callback, like for example an `access_token` from a provider.
-:::
-
-:::warning
-The session object is not persisted server side, even when using database sessions - only data such as the session token, the user, and the expiry time is stored in the session table.
-
-If you need to persist session data server side, you can use the `accessToken` returned for the session as a key - and connect to the database in the `session()` callback to access it. Session `accessToken` values do not rotate and are valid as long as the session is valid.
-
-If using JSON Web Tokens instead of database sessions, you should use the User ID or a unique key stored in the token (you will need to generate a key for this yourself on sign in, as access tokens for sessions are not generated when using JSON Web Tokens).
-:::
diff --git a/www/docs/configuration/databases.md b/www/docs/configuration/databases.md
deleted file mode 100644
index 94ef1d7c2a..0000000000
--- a/www/docs/configuration/databases.md
+++ /dev/null
@@ -1,238 +0,0 @@
----
-id: databases
-title: Databases
----
-
-NextAuth.js offers multiple database adapters:
-
-- [`typeorm-legacy`](./../adapters/typeorm/typeorm-overview)
-- [`prisma`](./../adapters/prisma)
-- [`fauna`](./../adapters/fauna)
-- [`dynamodb`](./../adapters/dynamodb)
-- [`firebase`](./../adapters/firebase)
-- [`pouchdb`](./../adapters/pouchdb)
-
-> As of **v4.0.0** NextAuth.js no longer ships with an adapter included by default. If you would like to persist any information, you need to install one of the many available adapters yourself. See the individual adapter documentation pages for more details.
-
-To learn more about databases in NextAuth.js and how they are used, check out [databases in the FAQ](/faq#databases).
-
----
-
-**The rest of this document covers the old default adapter (TypeORM).**
-
-## How to use a database
-
-## How to use a database
-
-You can specify database credentials as a [TypeORM configuration](https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md) object or connection string:
-
-```js title="pages/api/auth/[...nextauth].js"
-import TypeORMAdapter from "@next-auth/typeorm-legacy-adapter"
-import NextAuth from "next-auth"
-
-export default NextAuth({
- adapter: TypeORMAdapter(
- "mysql://nextauth:password@127.0.0.1:3306/database_name"
- ),
- // or...
- adapter: TypeORMAdapter({
- type: "mysql",
- host: "127.0.0.1",
- port: 3306,
- username: "nextauth",
- password: "password",
- database: "database_name",
- }),
-})
-```
-
-Both approaches are exactly equivalent:
-
-:::tip
-You can pass in any valid [TypeORM configuration option](https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md).
-
-_e.g. To set a prefix for all table names you can use the **entityPrefix** option as connection string parameter:_
-
-```js
-adapter: TypeORMAdapter(
- "mysql://nextauth:password@127.0.0.1:3306/database_name?entityPrefix=nextauth_"
-)
-```
-
-_…or as a database configuration object:_
-
-```js
-adapter: TypeORMAdapter({
- type: "mysql",
- host: "127.0.0.1",
- port: 3306,
- username: "nextauth",
- password: "password",
- database: "database_name",
- entityPrefix: "nextauth_",
-})
-```
-
-:::
-
----
-
-## Setting up a database
-
-Using SQL to create tables and columns is the recommended way to set up an SQL database for NextAuth.js.
-
-Check out the links below for SQL you can run to set up a database for NextAuth.js.
-
-- [MySQL Schema](/adapters/typeorm/mysql)
-- [Postgres Schema](/adapters/typeorm/postgres)
-
-_If you are running SQLite, MongoDB or a Document database you can skip this step._
-
-Alternatively, you can also have your database configured automatically using the `synchronize: true` option:
-
-```js
-adapter: TypeORMAdapter(
- "mysql://nextauth:password@127.0.0.1:3306/database_name?synchronize=true"
-)
-```
-
-```js
-adapter: TypeORMAdapter({
- type: "mysql",
- host: "127.0.0.1",
- port: 3306,
- username: "nextauth",
- password: "password",
- database: "database_name",
- synchronize: true,
-})
-```
-
-:::warning
-**The `synchronize` option should not be used against production databases.**
-
-It is useful to create the tables you need when setting up a database for the first time, but it should not be enabled against production databases as it may result in data loss if there is a difference between the schema that found in the database and the schema that the version of NextAuth.js being used is expecting.
-:::
-
----
-
-## Supported databases
-
-The default database adapter is TypeORM, but only some databases supported by TypeORM are supported by NextAuth.js as custom logic needs to be handled by NextAuth.js.
-
-Databases compatible with MySQL, Postgres and MongoDB should work out of the box with NextAuth.js. When used with any other database, NextAuth.js will assume an ANSI SQL compatible database.
-
-:::tip
-When configuring your database you also need to install an appropriate **node module** for your database.
-:::
-
-### MySQL
-
-Install module:
-`npm i mysql`
-
-#### Example
-
-```js
-adapter: TypeORMAdapter(
- "mysql://username:password@127.0.0.1:3306/database_name"
-)
-```
-
-### MariaDB
-
-Install module:
-`npm i mariadb`
-
-#### Example
-
-```js
-adapter: TypeORMAdapter(
- "mariadb://username:password@127.0.0.1:3306/database_name"
-)
-```
-
-### Postgres / CockroachDB
-
-Install module:
-`npm i pg`
-
-#### Example
-
-PostgresDB
-
-```js
-adapter: TypeORMAdapter(
- "postgres://username:password@127.0.0.1:5432/database_name"
-)
-```
-
-CockroachDB
-
-```js
-adapter: TypeORMAdapter(
- "postgres://username:password@127.0.0.1:26257/database_name"
-)
-```
-
-If the node is using Self-signed cert
-
-```js
-adapter: TypeORMAdapter({
- type: "cockroachdb",
- host: process.env.DATABASE_HOST,
- port: 26257,
- username: process.env.DATABASE_USER,
- password: process.env.DATABASE_PASSWORD,
- database: process.env.DATABASE_NAME,
- ssl: {
- rejectUnauthorized: false,
- ca: fs.readFileSync("/path/to/server-certificates/root.crt").toString(),
- },
-})
-```
-
-Read more: [https://node-postgres.com/features/ssl](https://node-postgres.com/features/ssl)
-
----
-
-### Microsoft SQL Server
-
-Install module:
-`npm i mssql`
-
-#### Example
-
-```js
-adapter: TypeORMAdapter("mssql://sa:password@localhost:1433/database_name")
-```
-
-### MongoDB
-
-Install module:
-`npm i mongodb`
-
-#### Example
-
-```js
-adapter: TypeORMAdapter(
- "mongodb://username:password@127.0.0.1:3306/database_name"
-)
-```
-
-### SQLite
-
-_SQLite is intended only for development / testing and not for production use._
-
-Install module:
-`npm i sqlite3`
-
-#### Example
-
-```js
-adapter: TypeORMAdapter("sqlite://localhost/:memory:")
-```
-
-## Other databases
-
-See the [documentation for adapters](/adapters/overview) for more information on advanced configuration, including how to use NextAuth.js with other databases using a [custom adapter](/tutorials/creating-a-database-adapter).
diff --git a/www/docs/configuration/events.md b/www/docs/configuration/events.md
deleted file mode 100644
index 2011a49eaf..0000000000
--- a/www/docs/configuration/events.md
+++ /dev/null
@@ -1,64 +0,0 @@
----
-id: events
-title: Events
----
-
-Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting or handling any other side-effects.
-
-You can specify a handler for any of these events below, for debugging or for an audit log.
-
-:::note
-The execution of your authentication API will be blocked by an `await` on your event handler. If your event handler starts any burdensome work it should not block its own promise on that work.
-:::
-
-## Events
-
-### signIn
-
-Sent on successful sign in.
-
-The message will be an object and contain:
-
-- `user` (from your adapter or from the provider if a `credentials` type provider)
-- `account` (from your adapter or the provider)
-- `profile` (from the provider, is `undefined` on `credentials` provider, use `user` instead)
-- `isNewUser` (whether your adapter had a user for this account already)
-
-### signOut
-
-Sent when the user signs out (logout).
-
-The message object will contain one of these depending on if you use JWT or database persisted sessions:
-
-- `token`: The JWT token for this session.
-- `session`: The session object from your adapter that is being ended
-
-### createUser
-
-Sent when the adapter is told to create a new user.
-
-The message object will contain the user.
-
-### updateUser
-
-Sent when the adapter is told to update an existing user. Currently this is only sent when the user verifies their email address.
-
-The message object will contain the user.
-
-### linkAccount
-
-Sent when an account in a given provider is linked to a user in our user database. For example, when a user signs up with Twitter or when an existing user links their Google account.
-
-The message object will contain:
-
-- `user`: The user object from your adapter.
-- `providerAccount`: The object returned from the provider.
-
-### session
-
-Sent at the end of a request for the current session.
-
-The message object will contain one of these depending on if you use JWT or database persisted sessions:
-
-- `token`: The JWT token for this session.
-- `session`: The session object from your adapter.
diff --git a/www/docs/configuration/options.md b/www/docs/configuration/options.md
deleted file mode 100644
index 2a6921cfc6..0000000000
--- a/www/docs/configuration/options.md
+++ /dev/null
@@ -1,487 +0,0 @@
----
-id: options
-title: Options
----
-
-## Environment Variables
-
-### NEXTAUTH_URL
-
-When deploying to production, set the `NEXTAUTH_URL` environment variable to the canonical URL of your site.
-
-```
-NEXTAUTH_URL=https://example.com
-```
-
-If your Next.js application uses a custom base path, specify the route to the API endpoint in full.
-
-_e.g. `NEXTAUTH_URL=https://example.com/custom-route/api/auth`_
-
-:::tip
-To set environment variables on Vercel, you can use the [dashboard](https://vercel.com/dashboard) or the `vercel env` command.
-:::
-
-### NEXTAUTH_URL_INTERNAL
-
-If provided, server-side calls will use this instead of `NEXTAUTH_URL`. Useful in environments when the server doesn't have access to the canonical URL of your site. Defaults to `NEXTAUTH_URL`.
-
-```
-NEXTAUTH_URL_INTERNAL=http://10.240.8.16
-```
-
----
-
-## Options
-
-Options are passed to NextAuth.js when initializing it in an API route.
-
-### providers
-
-- **Default value**: `[]`
-- **Required**: _Yes_
-
-#### Description
-
-An array of authentication providers for signing in (e.g. Google, Facebook, Twitter, GitHub, Email, etc) in any order. This can be one of the built-in providers or an object with a custom provider.
-
-If you need to use an asynchronous function in your provider instantiation, you can setup your `[...nextauth].js` file like so:
-
-```js
-export default async function handler(req, res) {
- NextAuth(req, res, {
- providers: [
- Providers.IdentityServer4({
- id: "identity-server",
- clientSecret: await GetSecret(),
- }),
- ],
- })
-}
-```
-
-See the [providers documentation](/configuration/providers) for a list of supported providers and how to use them.
-
----
-
-### database
-
-- **Default value**: `null`
-- **Required**: _No (unless using email provider)_
-
-#### Description
-
-[A database connection string or configuration object.](/configuration/databases)
-
----
-
-### secret
-
-- **Default value**: `string` (_SHA hash of the "options" object_)
-- **Required**: _No - but strongly recommended!_
-
-#### Description
-
-A random string used to hash tokens, sign cookies and generate cryptographic keys.
-
-If not specified, it uses a hash for all configuration options, including Client ID / Secrets for entropy.
-
-The default behaviour is volatile, and it is strongly recommended you explicitly specify a value to avoid invalidating end user sessions when configuration changes are deployed.
-
----
-
-### session
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-The `session` object and all properties on it are optional.
-
-Default values for this option are shown below:
-
-```js
-session: {
- // Use JSON Web Tokens for session instead of database sessions.
- // This option can be used with or without a database for users/accounts.
- // Note: `jwt` is automatically set to `true` if no database is specified.
- jwt: false,
-
- // Seconds - How long until an idle session expires and is no longer valid.
- maxAge: 30 * 24 * 60 * 60, // 30 days
-
- // Seconds - Throttle how frequently to write to database to extend a session.
- // Use it to limit write operations. Set to 0 to always update the database.
- // Note: This option is ignored if using JSON Web Tokens
- updateAge: 24 * 60 * 60, // 24 hours
-}
-```
-
----
-
-### jwt
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-JSON Web Tokens can be used for session tokens if enabled with `session: { jwt: true }` option. JSON Web Tokens are enabled by default if you have not specified a database.
-
-By default JSON Web Tokens are signed (JWS) but not encrypted (JWE), as JWT encryption adds additional overhead and comes with some caveats. You can enable encryption by setting `encryption: true`.
-
-#### JSON Web Token Options
-
-```js
-jwt: {
- // A secret to use for key generation - you should set this explicitly
- // Defaults to NextAuth.js secret if not explicitly specified.
- // This is used to generate the actual signingKey and produces a warning
- // message if not defined explicitly.
- // You can generate a secret be using `openssl rand -base64 64`
- secret: 'INp8IvdIyeMcoGAgFGoA61DdBglwwSqnXJZkgz8PSnw',
- // You can generate a signing key using `jose newkey -s 512 -t oct -a HS512`
- // This gives you direct knowledge of the key used to sign the token so you can use it
- // to authenticate indirectly (eg. to a database driver)
- signingKey: {
- kty: "oct",
- kid: "Dl893BEV-iVE-x9EC52TDmlJUgGm9oZ99_ZL025Hc5Q",
- alg: "HS512",
- k: "K7QqRmJOKRK2qcCKV_pi9PSBv3XP0fpTu30TP8xn4w01xR3ZMZM38yL2DnTVPVw6e4yhdh0jtoah-i4c_pZagA"
- },
- // If you chose something other than the default algorithm for the signingKey (HS512)
- // you also need to configure the algorithm
- verificationOptions: {
- algorithms: ['HS256']
- },
- // Set to true to use encryption. Defaults to false (signing only).
- encryption: true,
- // You can generate an encryption key by using `npx node-jose-tools newkey -s 256 -t oct -a A256GCM -u enc`
- encryptionKey: "",
- // decryptionKey: encryptionKey,
- decryptionOptions: {
- algorithms: ['A256GCM']
- },
- // You can define your own encode/decode functions for signing and encryption
- // if you want to override the default behaviour.
- async encode({ secret, token, maxAge }) {},
- async decode({ secret, token, maxAge }) {},
-}
-```
-
-An example JSON Web Token contains a payload like this:
-
-```js
-{
- name: 'Iain Collins',
- email: 'me@iaincollins.com',
- picture: 'https://example.com/image.jpg',
- iat: 1594601838,
- exp: 1597193838
-}
-```
-
-#### JWT Helper
-
-You can use the built-in `getToken()` helper method to verify and decrypt the token, like this:
-
-```js
-import { getToken } from "next-auth/jwt"
-
-const secret = process.env.JWT_SECRET
-
-export default async (req, res) => {
- const token = await getToken({ req, secret })
- console.log("JSON Web Token", token)
- res.end()
-}
-```
-
-_For convenience, this helper function is also able to read and decode tokens passed in an HTTP Bearer header._
-
-**Required**
-
-The getToken() helper requires the following options:
-
-- `req` - (object) Request object
-- `secret` - (string) JWT Secret
-
-You must also pass _any options configured on the `jwt` option_ to the helper.
-
-e.g. Including custom session `maxAge` and custom signing and/or encryption keys or options
-
-**Optional**
-
-It also supports the following options:
-
-- `secureCookie` - (boolean) Use secure prefixed cookie name
-
- By default, the helper function will attempt to determine if it should use the secure prefixed cookie (e.g. `true` in production and `false` in development, unless NEXTAUTH_URL contains an HTTPS URL).
-
-- `cookieName` - (string) Session token cookie name
-
- The `secureCookie` option is ignored if `cookieName` is explicitly specified.
-
-- `raw` - (boolean) Get raw token (not decoded)
-
- If set to `true` returns the raw token without decrypting or verifying it.
-
-:::note
-The JWT is stored in the Session Token cookie, the same cookie used for tokens with database sessions.
-:::
-
----
-
-### pages
-
-- **Default value**: `{}`
-- **Required**: _No_
-
-#### Description
-
-Specify URLs to be used if you want to create custom sign in, sign out and error pages.
-
-Pages specified will override the corresponding built-in page.
-
-_For example:_
-
-```js
-pages: {
- signIn: '/auth/signin',
- signOut: '/auth/signout',
- error: '/auth/error', // Error code passed in query string as ?error=
- verifyRequest: '/auth/verify-request', // (used for check email message)
- newUser: '/auth/new-user' // New users will be directed here on first sign in (leave the property out if not of interest)
-}
-```
-
-See the documentation for the [pages option](/configuration/pages) for more information.
-
----
-
-### callbacks
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-Callbacks are asynchronous functions you can use to control what happens when an action is performed.
-
-Callbacks are extremely powerful, especially in scenarios involving JSON Web Tokens as they allow you to implement access controls without a database and to integrate with external databases or APIs.
-
-You can specify a handler for any of the callbacks below.
-
-```js
-callbacks: {
- async signIn({ user, account, profile, email, credentials }) {
- return true
- },
- async redirect({ url, baseUrl }) {
- return baseUrl
- },
- async session({ session, token, user }) {
- return session
- },
- async jwt({ token, user, account, profile, isNewUser }) {
- return token
- }
-}
-```
-
-See the [callbacks documentation](/configuration/callbacks) for more information on how to use the callback functions.
-
----
-
-### events
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-Events are asynchronous functions that do not return a response, they are useful for audit logging.
-
-You can specify a handler for any of these events below - e.g. for debugging or to create an audit log.
-
-The content of the message object varies depending on the flow (e.g. OAuth or Email authentication flow, JWT or database sessions, etc). See the [events documentation](/configuration/events) for more information on the form of each message object and how to use the events functions.
-
-```js
-events: {
- async signIn(message) { /* on successful sign in */ },
- async signOut(message) { /* on signout */ },
- async createUser(message) { /* user created */ },
- async updateUser(message) { /* user updated - e.g. their email was verified */ },
- async linkAccount(message) { /* account (e.g. Twitter) linked to a user */ },
- async session(message) { /* session is active */ },
- async error(message) { /* error in authentication flow */ }
-}
-```
-
----
-
-### adapter
-
-- **Default value**: none
-- **Required**: _No_
-
-#### Description
-
-By default NextAuth.js does not include an adapter any longer. If you would like to persist user / account data, please install one of the many available adapters. More information can be found in the [adapter documentation](/adapters/overview).
-
----
-
-### debug
-
-- **Default value**: `false`
-- **Required**: _No_
-
-#### Description
-
-Set debug to `true` to enable debug messages for authentication and database operations.
-
----
-
-### logger
-
-- **Default value**: `console`
-- **Required**: _No_
-
-#### Description
-
-Override any of the logger levels (`undefined` levels will use the built-in logger), and intercept logs in NextAuth. You can use this to send NextAuth logs to a third-party logging service.
-
-The `code` parameter for `error` and `warn` are explained in the [Warnings](/warnings) and [Errors](/errors) pages respectively.
-
-Example:
-
-```js title="/pages/api/auth/[...nextauth].js"
-import log from "logging-service"
-
-export default NextAuth({
- ...
- logger: {
- error(code, metadata) {
- log.error(code, metadata)
- },
- warn(code) {
- log.warn(code)
- },
- debug(code, metadata) {
- log.debug(code, metadata)
- }
- }
- ...
-})
-```
-
-:::note
-If the `debug` level is defined by the user, it will be called regardless of the `debug: false` [option](#debug).
-:::
-
----
-
-### theme
-
-- **Default value**: `"auto"`
-- **Required**: _No_
-
-#### Description
-
-Changes the theme of [pages](/configuration/pages). Set to `"light"`, if you want to force pages to always be light. Set to `"dark"`, if you want to force pages to always be dark. Set to `"auto"`, (or leave this option out) if you want the pages to follow the preferred system theme. (Uses the [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media query.)
-
----
-
-## Advanced Options
-
-Advanced options are passed the same way as basic options, but may have complex implications or side effects. You should try to avoid using advanced options unless you are very comfortable using them.
-
----
-
-### useSecureCookies
-
-- **Default value**: `true` for HTTPS sites / `false` for HTTP sites
-- **Required**: _No_
-
-#### Description
-
-When set to `true` (the default for all site URLs that start with `https://`) then all cookies set by NextAuth.js will only be accessible from HTTPS URLs.
-
-This option defaults to `false` on URLs that start with `http://` (e.g. `http://localhost:3000`) for developer convenience.
-
-You can manually set this option to `false` to disable this security feature and allow cookies to be accessible from non-secured URLs (this is not recommended).
-
-:::note
-Properties on any custom `cookies` that are specified override this option.
-:::
-
-:::warning
-Setting this option to _false_ in production is a security risk and may allow sessions to be hijacked if used in production. It is intended to support development and testing. Using this option is not recommended.
-:::
-
----
-
-### cookies
-
-- **Default value**: `{}`
-- **Required**: _No_
-
-#### Description
-
-You can override the default cookie names and options for any of the cookies used by NextAuth.js.
-
-This is an advanced option and using it is not recommended as you may break authentication or introduce security flaws into your application.
-
-You can specify one or more cookies with custom properties, but if you specify custom options for a cookie you must provide all the options for that cookie.
-
-If you use this feature, you will likely want to create conditional behaviour to support setting different cookies policies in development and production builds, as you will be opting out of the built-in dynamic policy.
-
-:::tip
-An example of a use case for this option is to support sharing session tokens across subdomains.
-:::
-
-#### Example
-
-```js
-cookies: {
- sessionToken: {
- name: `__Secure-next-auth.session-token`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- callbackUrl: {
- name: `__Secure-next-auth.callback-url`,
- options: {
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- csrfToken: {
- name: `__Host-next-auth.csrf-token`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- pkceCodeVerifier: {
- name: `${cookiePrefix}next-auth.pkce.code_verifier`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: useSecureCookies
- }
- }
-}
-```
-
-:::warning
-Using a custom cookie policy may introduce security flaws into your application and is intended as an option for advanced users who understand the implications. Using this option is not recommended.
-:::
diff --git a/www/docs/configuration/pages.md b/www/docs/configuration/pages.md
deleted file mode 100644
index 6486987140..0000000000
--- a/www/docs/configuration/pages.md
+++ /dev/null
@@ -1,196 +0,0 @@
----
-id: pages
-title: Pages
----
-
-NextAuth.js automatically creates simple, unbranded authentication pages for handling Sign in, Sign out, Email Verification and displaying error messages.
-
-The options displayed on the sign up page are automatically generated based on the providers specified in the options passed to NextAuth.js.
-
-To add a custom login page, you can use the `pages` option:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-...
- pages: {
- signIn: '/auth/signin',
- signOut: '/auth/signout',
- error: '/auth/error', // Error code passed in query string as ?error=
- verifyRequest: '/auth/verify-request', // (used for check email message)
- newUser: '/auth/new-user' // New users will be directed here on first sign in (leave the property out if not of interest)
- }
-...
-```
-
-## Error codes
-
-We purposefully restrict the returned error codes for increased security.
-
-### Error page
-
-The following errors are passed as error query parameters to the default or overriden error page:
-
-- **Configuration**: There is a problem with the server configuration. Check if your [options](/configuration/options#options) is correct.
-- **AccessDenied**: Usually occurs, when you restricted access through the [`signIn` callback](/configuration/callbacks#sign-in-callback), or [`redirect` callback](/configuration/callbacks#redirect-callback)
-- **Verification**: Related to the Email provider. The token has expired or has already been used
-- **Default**: Catch all, will apply, if none of the above matched
-
-Example: `/auth/error?error=Configuration`
-
-### Sign-in page
-
-The following errors are passed as error query parameters to the default or overriden sign-in page:
-
-- **OAuthSignin**: Error in constructing an authorization URL ([1](https://github.com/nextauthjs/next-auth/blob/457952bb5abf08b09861b0e5da403080cd5525be/src/server/lib/signin/oauth.js), [2](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/pkce-handler.js), [3](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/state-handler.js)),
-- **OAuthCallback**: Error in handling the response ([1](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/callback.js), [2](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/pkce-handler.js), [3](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/state-handler.js)) from an OAuth provider.
-- **OAuthCreateAccount**: Could not create OAuth provider user in the database.
-- **EmailCreateAccount**: Could not create email provider user in the database.
-- **Callback**: Error in the [OAuth callback handler route](https://github.com/nextauthjs/next-auth/blob/main/src/server/routes/callback.js)
-- **OAuthAccountNotLinked**: If the email on the account is already linked, but not with this OAuth account
-- **EmailSignin**: Sending the e-mail with the verification token failed
-- **CredentialsSignin**: The `authorize` callback returned `null` in the [Credentials provider](/providers/credentials). We don't recommend providing information about which part of the credentials were wrong, as it might be abused by malicious hackers.
-- **SessionRequired**: The content of this page requires you to be signed in at all times. See [useSession](/getting-started/client#require-session) for configuration.
-- **Default**: Catch all, will apply, if none of the above matched
-
-Example: `/auth/error?error=Default`
-
-## Theming
-
-By default, the built-in pages will follow the system theme, utilizing the [`prefer-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) Media Query. You can override this to always use a dark or light theme, through the [`theme` option](/configuration/options#theme).
-
-## Examples
-
-### OAuth Sign in
-
-In order to get the available authentication providers and the URLs to use for them, you can make a request to the API endpoint `/api/auth/providers`:
-
-```jsx title="pages/auth/signin.js"
-import { getProviders, signIn } from "next-auth/react"
-
-export default function SignIn({ Providers }) {
- return (
- <>
- {Object.values(providers).map((provider) => (
-
-
-
- ))}
- >
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const providers = await getProviders()
- return {
- props: { providers },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async () => {
- return {
- providers: await getProviders()
- }
-}
-*/
-```
-
-### Email Sign in
-
-If you create a custom sign in form for email sign in, you will need to submit both fields for the **email** address and **csrfToken** from **/api/auth/csrf** in a POST request to **/api/auth/signin/email**.
-
-```jsx title="pages/auth/email-signin.js"
-import { getCsrfToken } from "next-auth/react"
-
-export default function SignIn({ csrfToken }) {
- return (
-
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const csrfToken = await getCsrfToken(context)
- return {
- props: { csrfToken },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async (context) => {
- return {
- csrfToken: await getCsrfToken(context)
- }
-}
-*/
-```
-
-You can also use the `signIn()` function which will handle obtaining the CSRF token for you:
-
-```js
-signIn("email", { email: "jsmith@example.com" })
-```
-
-### Credentials Sign in
-
-If you create a sign in form for credentials based authentication, you will need to pass a **csrfToken** from **/api/auth/csrf** in a POST request to **/api/auth/callback/credentials**.
-
-```jsx title="pages/auth/credentials-signin.js"
-import { getCsrfToken } from "next-auth/react"
-
-export default function SignIn({ csrfToken }) {
- return (
-
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- return {
- props: {
- csrfToken: await getCsrfToken(context),
- },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async (context) => {
- return {
- csrfToken: await getCsrfToken(context)
- }
-}
-*/
-```
-
-You can also use the `signIn()` function which will handle obtaining the CSRF token for you:
-
-```js
-signIn("credentials", { username: "jsmith", password: "1234" })
-```
-
-:::tip
-Remember to put any custom pages in a folder outside **/pages/api** which is reserved for API code. As per the examples above, a location convention suggestion is `pages/auth/...`.
-:::
diff --git a/www/docs/configuration/providers.md b/www/docs/configuration/providers.md
deleted file mode 100644
index 8ed69243f6..0000000000
--- a/www/docs/configuration/providers.md
+++ /dev/null
@@ -1,296 +0,0 @@
----
-id: providers
-title: Providers
----
-
-Authentication Providers in **NextAuth.js** are services that can be used to sign in a user.
-
-There's four ways a user can be signed in:
-
-- [Using a built-in OAuth Provider](#oauth-providers) (e.g Github, Twitter, Google, etc...)
-- [Using a custom OAuth Provider](#using-a-custom-provider)
-- [Using Email](#email-provider)
-- [Using Credentials](#credentials-provider)
-
-:::note
-NextAuth.js is designed to work with any OAuth service, it supports **OAuth 1.0**, **1.0A** and **2.0** and has built-in support for most popular sign-in services.
-:::
-
-## OAuth Providers
-
-### Available providers
-
-
-
-### How to
-
-1. Register your application at the developer portal of your provider. There are links above to the developer docs for most supported providers with details on how to register your application.
-
-2. The redirect URI should follow this format:
-
-```
-[origin]/api/auth/callback/[provider]
-```
-
-For example, Twitter on `localhost` this would be:
-
-```
-http://localhost:3000/api/auth/callback/twitter
-```
-
-3. Create a `.env` file at the root of your project and add the client ID and client secret. For Twitter this would be:
-
-```
-TWITTER_ID=YOUR_TWITTER_CLIENT_ID
-TWITTER_SECRET=YOUR_TWITTER_CLIENT_SECRET
-```
-
-4. Now you can add the provider settings to the NextAuth options object. You can add as many OAuth providers as you like, as you can see `providers` is an array.
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET
- })
-],
-...
-```
-
-5. Once a provider has been setup, you can sign in at the following URL: `[origin]/api/auth/signin`. This is an unbranded auto-generated page with all the configured providers.
-
-
-
-### Options
-
-| Name | Description | Type | Required |
-| :-----------------: | :--------------------------------------------------------------: | :---------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `oauth` | `"oauth"` | Yes |
-| version | OAuth version (e.g. '1.0', '1.0a', '2.0') | `string` | Yes |
-| scope | OAuth access scopes (expects string with space as separator) | `string` | Yes |
-| params | Extra URL params sent when calling `accessTokenUrl` | `Object` | Yes |
-| accessTokenUrl | Endpoint to retrieve an access token | `string` | Yes |
-| authorizationUrl | Endpoint to request authorization from the user | `string` | Yes |
-| requestTokenUrl | Endpoint to retrieve a request token | `string` | Yes |
-| profileUrl | Endpoint to retrieve the user's profile | `string` | Yes |
-| clientId | Client ID of the OAuth provider | `string` | Yes |
-| clientSecret | Client Secret of the OAuth provider | `string` | Yes |
-| profile | A callback returning an object with the user's info | `(profile, tokens) => Object` | Yes |
-| checks | Additional security checks on OAuth providers (default: [`state`]) | `("pkce"|"state"|"none")[]` | No |
-| headers | Any headers that should be sent to the OAuth provider | `Object` | No |
-| authorizationParams | Additional params to be sent to the authorization endpoint | `Object` | No |
-| idToken | Set to `true` for services that use ID Tokens (e.g. OpenID) | `boolean` | No |
-| region | Only when using BattleNet | `string` | No |
-| domain | Only when using certain Providers | `string` | No |
-| tenantId | Only when using Azure, Active Directory, B2C, FusionAuth | `string` | No |
-
-:::tip
-Even if you are using a built-in provider, you can override any of these options to tweak the default configuration.
-
-```js title=[...nextauth].js
-import Providers from "next-auth/providers"
-
-Providers.Auth0({
- clientId: process.env.CLIENT_ID,
- clientSecret: process.env.CLIENT_SECRET,
- domain: process.env.DOMAIN,
- scope: "openid your_custom_scope", // We do provide a default, but this will override it if defined
- profile(profile) {
- return {} // Return the profile in a shape that is different from the built-in one.
- },
-})
-```
-
-:::
-
-### Using a custom provider
-
-You can use an OAuth provider that isn't built-in by using a custom object.
-
-As an example of what this looks like, this is the provider object returned for the Google provider:
-
-```js
-{
- id: "google",
- name: "Google",
- type: "oauth",
- version: "2.0",
- scope: "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
- params: { grant_type: "authorization_code" },
- accessTokenUrl: "https://accounts.google.com/o/oauth2/token",
- requestTokenUrl: "https://accounts.google.com/o/oauth2/auth",
- authorizationUrl: "https://accounts.google.com/o/oauth2/auth?response_type=code",
- profileUrl: "https://www.googleapis.com/oauth2/v1/userinfo?alt=json",
- async profile(profile, tokens) {
- // You can use the tokens, in case you want to fetch more profile information
- // For example several OAuth providers do not return email by default.
- // Depending on your provider, will have tokens like `access_token`, `id_token` and or `refresh_token`
- return {
- id: profile.id,
- name: profile.name,
- email: profile.email,
- image: profile.picture
- }
- },
- clientId: "",
- clientSecret: ""
-}
-```
-
-Replace all the options in this JSON object with the ones from your custom provider - be sure to give it a unique ID and specify the correct OAuth version - and add it to the providers option when initializing the library:
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET,
- }),
- {
- id: 'customProvider',
- name: 'CustomProvider',
- type: 'oauth',
- version: '2.0',
- scope: '' // Make sure to request the users email address
- ...
- }
-]
-...
-```
-
-### Adding a new provider
-
-If you think your custom provider might be useful to others, we encourage you to open a PR and add it to the built-in list so others can discover it much more easily!
-
-You only need to add two changes:
-
-1. Add your config: [`src/providers/{provider}.js`](https://github.com/nextauthjs/next-auth/tree/main/src/providers)
- • make sure you use a named default export, like this: `export default function YourProvider`
-2. Add provider documentation: [`www/docs/providers/{provider}.md`](https://github.com/nextauthjs/next-auth/tree/main/www/docs/providers)
-3. Add it to our [provider types](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts) (for TS projects)
- • you just need to add your new provider name to [this list](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts#L56-L97)
- • in case your new provider accepts some custom options, you can [add them here](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts#L48-L53)
-
-That's it! 🎉 Others will be able to discover this provider much more easily now!
-
-## Email Provider
-
-### How to
-
-The Email provider uses email to send "magic links" that can be used sign in, you will likely have seen them before if you have used software like Slack.
-
-Adding support for signing in via email in addition to one or more OAuth services provides a way for users to sign in if they lose access to their OAuth account (e.g. if it is locked or deleted).
-
-Configuration is similar to other providers, but the options are different:
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- // maxAge: 24 * 60 * 60, // How long email links are valid for (default 24h)
- }),
-],
-...
-```
-
-See the [Email provider documentation](/providers/email) for more information on how to configure email sign in.
-
-:::note
-The email provider requires a database, it cannot be used without one.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------------------: | :---------------------------------------------------------------------------------: | :------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `email` | `"email"` | Yes |
-| server | Path or object pointing to the email server | `string` or `Object` | Yes |
-| sendVerificationRequest | Callback to execute when a verification request is sent | `(params) => Promise` | Yes |
-| from | The email address from which emails are sent, default: "" | `string` | No |
-| maxAge | How long until the e-mail can be used to log the user in seconds. Defaults to 1 day | `number` | No |
-
-## Credentials Provider
-
-### How to
-
-The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
-
-It is intended to support use cases where you have an existing system you need to authenticate users against.
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Credentials({
- // The name to display on the sign in form (e.g. 'Sign in with...')
- name: 'Credentials',
- // The credentials is used to generate a suitable form on the sign in page.
- // You can specify whatever fields you are expecting to be submitted.
- // e.g. domain, username, password, 2FA token, etc.
- credentials: {
- username: { label: "Username", type: "text", placeholder: "jsmith" },
- password: { label: "Password", type: "password" }
- },
- async authorize(credentials, req) {
- // You need to provide your own logic here that takes the credentials
- // submitted and returns either a object representing a user or value
- // that is false/null if the credentials are invalid.
- // e.g. return { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
- // You can also use the `req` object to obtain additional parameters
- // (i.e., the request IP address)
- const res = await fetch("/your/endpoint", {
- method: 'POST',
- body: JSON.stringify(credentials),
- headers: { "Content-Type": "application/json" }
- })
- const user = await res.json()
-
- // If no error and we have user data, return it
- if (res.ok && user) {
- return user
- }
- // Return null if user data could not be retrieved
- return null
- }
- })
-]
-...
-```
-
-See the [Credentials provider documentation](/providers/credentials) for more information.
-
-:::note
-The Credentials provider can only be used if JSON Web Tokens are enabled for sessions. Users authenticated with the Credentials provider are not persisted in the database.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------: | :-----------------------------------------------: | :-----------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `credentials` | `"credentials"` | Yes |
-| credentials | The credentials to sign-in with | `Object` | Yes |
-| authorize | Callback to execute once user is to be authorized | `(credentials, req) => Promise` | Yes |
diff --git a/www/docs/configuration/providers/credentials.md b/www/docs/configuration/providers/credentials.md
deleted file mode 100644
index 1f7cd5ae5a..0000000000
--- a/www/docs/configuration/providers/credentials.md
+++ /dev/null
@@ -1,66 +0,0 @@
----
-id: credentials-provider
-title: Credentials Provider
----
-
-### How to
-
-The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
-
-It is intended to support use cases where you have an existing system you need to authenticate users against.
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Credentials({
- // The name to display on the sign in form (e.g. 'Sign in with...')
- name: 'Credentials',
- // The credentials is used to generate a suitable form on the sign in page.
- // You can specify whatever fields you are expecting to be submitted.
- // e.g. domain, username, password, 2FA token, etc.
- credentials: {
- username: { label: "Username", type: "text", placeholder: "jsmith" },
- password: { label: "Password", type: "password" }
- },
- async authorize(credentials, req) {
- // You need to provide your own logic here that takes the credentials
- // submitted and returns either a object representing a user or value
- // that is false/null if the credentials are invalid.
- // e.g. return { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
- // You can also use the `req` object to obtain additional parameters
- // (i.e., the request IP address)
- const res = await fetch("/your/endpoint", {
- method: 'POST',
- body: JSON.stringify(credentials),
- headers: { "Content-Type": "application/json" }
- })
- const user = await res.json()
-
- // If no error and we have user data, return it
- if (res.ok && user) {
- return user
- }
- // Return null if user data could not be retrieved
- return null
- }
- })
-]
-...
-```
-
-See the [Credentials provider documentation](/providers/credentials) for more information.
-
-:::note
-The Credentials provider can only be used if JSON Web Tokens are enabled for sessions. Users authenticated with the Credentials provider are not persisted in the database.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------: | :-----------------------------------------------: | :-----------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `credentials` | `"credentials"` | Yes |
-| credentials | The credentials to sign-in with | `Object` | Yes |
-| authorize | Callback to execute once user is to be authorized | `(credentials, req) => Promise` | Yes |
diff --git a/www/docs/configuration/providers/email.md b/www/docs/configuration/providers/email.md
deleted file mode 100644
index 1436355909..0000000000
--- a/www/docs/configuration/providers/email.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: email-provider
-title: Email Provider
----
-
-### How to
-
-The Email provider uses email to send "magic links" that can be used sign in, you will likely have seen them before if you have used software like Slack.
-
-Adding support for signing in via email in addition to one or more OAuth services provides a way for users to sign in if they lose access to their OAuth account (e.g. if it is locked or deleted).
-
-Configuration is similar to other providers, but the options are different:
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- // maxAge: 24 * 60 * 60, // How long email links are valid for (default 24h)
- }),
-],
-...
-```
-
-See the [Email provider documentation](/providers/email) for more information on how to configure email sign in.
-
-:::note
-The email provider requires a database, it cannot be used without one.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------------------: | :---------------------------------------------------------------------------------: | :------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `email` | `"email"` | Yes |
-| server | Path or object pointing to the email server | `string` or `Object` | Yes |
-| sendVerificationRequest | Callback to execute when a verification request is sent | `(params) => Promise` | Yes |
-| from | The email address from which emails are sent, default: "" | `string` | No |
-| maxAge | How long until the e-mail can be used to log the user in seconds. Defaults to 1 day | `number` | No |
diff --git a/www/docs/configuration/providers/oauth.md b/www/docs/configuration/providers/oauth.md
deleted file mode 100644
index b9e8293ee0..0000000000
--- a/www/docs/configuration/providers/oauth.md
+++ /dev/null
@@ -1,265 +0,0 @@
----
-id: oauth-provider
-title: OAuth Provider
----
-
-Authentication Providers in **NextAuth.js** are OAuth definitions which allow your users to sign in with their favorite preexisting logins. You can use any of our many predefined providers, or write your own custom OAuth configuration.
-
-- [Using a built-in OAuth Provider](#oauth-providers) (e.g Github, Twitter, Google, etc...)
-- [Using a custom OAuth Provider](#using-a-custom-provider)
-
-:::note
-NextAuth.js is designed to work with any OAuth service, it supports **OAuth 1.0**, **1.0A**, **2.0** and **OpenID Connect** and has built-in support for most popular sign-in services.
-:::
-
-Without going into too much detail, the OAuth flow generally has 6 parts:
-
-1. The application requests authorization to access service resources from the user
-2. If the user authorized the request, the application receives an authorization grant
-3. The application requests an access token from the authorization server (API) by presenting authentication of its own identity, and the authorization grant
-4. If the application identity is authenticated and the authorization grant is valid, the authorization server (API) issues an access token to the application. Authorization is complete.
-5. The application requests the resource from the resource server (API) and presents the access token for authentication
-6. If the access token is valid, the resource server (API) serves the resource to the application
-
-
-Source: https://dzone.com/articles/open-id-connect-authentication-with-oauth20-author
-
-For more details, check out Aaron Parecki's blog post [OAuth2 Simplified](https://aaronparecki.com/oauth-2-simplified/) or Postman's blog post [OAuth 2.0: Implicit Flow is Dead, Try PKCE Instead](https://blog.postman.com/pkce-oauth-how-to/).
-
-## OAuth Providers
-
-### Available providers
-
-
-
-### How to
-
-1. Register your application at the developer portal of your provider. There are usually links to the portals included in the aforementioned documentation pages for each supported provider with details on how to register your application.
-
-2. The redirect URI (sometimes called Callback URL) should follow this format:
-
-```
-[origin]/api/auth/callback/[provider]
-```
-
-For example, Twitter on `localhost` this would be:
-
-```
-http://localhost:3000/api/auth/callback/twitter
-```
-
-Using Google in our example application would look like this:
-
-```
-https://next-auth-example.vercel.app/api/auth/callback/google
-```
-
-3. Create a `.env` file at the root of your project and add the client ID and client secret. For Twitter this would be:
-
-```
-TWITTER_ID=YOUR_TWITTER_CLIENT_ID
-TWITTER_SECRET=YOUR_TWITTER_CLIENT_SECRET
-```
-
-4. Now you can add the provider settings to the NextAuth options object. You can add as many OAuth providers as you like, as you can see `providers` is an array.
-
-```js title="pages/api/auth/[...nextauth].js"
-import TwitterProvider from "next-auth/providers/"
-...
-providers: [
- TwitterProvider({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET
- })
-],
-...
-```
-
-5. Once a provider has been setup, you can sign in at the following URL: `[origin]/api/auth/signin`. This is an unbranded auto-generated page with all the configured providers.
-
-
-
-### Options
-
-```ts
-interface OAuthConfig {
-/**
- * OpenID Connect (OIDC) compliant providers can configure
- * this instead of `authorize`/`token`/`userinfo` options
- * without further configuration needed in most cases.
- * You can still use the `authorize`/`token`/`userinfo`
- * options for advanced control.
- *
- * [Authorization Server Metadata](https://datatracker.ietf.org/doc/html/rfc8414#section-3)
- */
- wellKnown?: string
- /**
- * The login process will be initiated by sending the user to this URL.
- *
- * [Authorization endpoint](https://datatracker.ietf.org/doc/html/rfc6749#section-3.1)
- */
- authorization: EndpointHandler
- /**
- * Endpoint that returns OAuth 2/OIDC tokens and information about them.
- * This includes `access_token`, `id_token`, `refresh_token`, etc.
- *
- * [Token endpoint](https://datatracker.ietf.org/doc/html/rfc6749#section-3.2)
- */
- token: EndpointHandler<
- UrlParams,
- {
- /**
- * Parameters extracted from the request to the `/api/auth/callback/:providerId` endpoint.
- * Contains params like `state`.
- */
- params: CallbackParamsType
- /**
- * When using this custom flow, make sure to do all the necessary security checks.
- * Thist object contains parameters you have to match against the request to make sure it is valid.
- */
- checks: OAuthChecks
- },
- { tokens: TokenSet }
- >
- /**
- * When using an OAuth 2 provider, the user information must be requested
- * through an additional request from the userinfo endpoint.
- *
- * [Userinfo endpoint](https://www.oauth.com/oauth2-servers/signing-in-with-google/verifying-the-user-info)
- */
- userinfo?: EndpointHandler
- type: "oauth"
- version: string
- accessTokenUrl: string
- requestTokenUrl?: string
- profile(profile: P, tokens: TokenSet): Awaitable
- checks?: ChecksType | ChecksType[]
- clientId: string
- clientSecret:
- | string
- | Record<"appleId" | "teamId" | "privateKey" | "keyId", string>
- /**
- * If set to `true`, the user information will be extracted
- * from the `id_token` claims, instead of
- * making a request to the `userinfo` endpoint.
- *
- * `id_token` is usually present in OpenID Connect (OIDC) compliant providers.
- *
- * [`id_token` explanation](https://www.oauth.com/oauth2-servers/openid-connect/id-tokens)
- */
- idToken?: boolean
- region?: string
- issuer?: string
- tenantId?: string
-}
-```
-
-Even if you are using a built-in provider, you can override any of these options to tweak the default configuration.
-
-```js title=[...nextauth].js
-import Auth0Provider from "next-auth/providers/auth0"
-
-Auth0Provider({
- clientId: process.env.CLIENT_ID,
- clientSecret: process.env.CLIENT_SECRET,
- domain: process.env.DOMAIN,
- scope: "openid your_custom_scope", // We do provide a default, but this will override it if defined
- profile(profile) {
- return {} // Return the profile in a shape that is different from the built-in one.
- },
-})
-```
-
-### Using a custom provider
-
-You can use an OAuth provider that isn't built-in by using a custom object.
-
-As an example of what this looks like, this is the provider object returned for the Google provider:
-
-```js
-{
- id: "google",
- name: "Google",
- type: "oauth",
- wellKnown: "https://accounts.google.com/.well-known/openid-configuration",
- authorization: { params: { scope: "openid email profile" } },
- idToken: true,
- checks: ["pkce", "state"],
- profile(profile) {
- return {
- id: profile.sub,
- name: profile.name,
- email: profile.email,
- image: profile.picture,
- }
- },
-}
-```
-
-As you can see, if your provider supports OpenID Connect and the `/.well-known/openid-configuration` endpoint contains support for the `grant_type`: `authorization_code`, you only need to pass the URL to that configuration file and define some basic fields like `name` and `type`.
-
-Otherwise, you can pass a more full set of URLs for each OAuth2.0 flow step, for example:
-
-```js
-{
- id: "kakao",
- name: "Kakao",
- type: "oauth",
- authorization: "https://kauth.kakao.com/oauth/authorize",
- token: "https://kauth.kakao.com/oauth/token",
- userinfo: "https://kapi.kakao.com/v2/user/me",
- profile(profile) {
- return {
- id: profile.id,
- name: profile.kakao_account?.profile.nickname,
- email: profile.kakao_account?.email,
- image: profile.kakao_account?.profile.profile_image_url,
- }
- },
-}
-```
-
-Replace all the options in this JSON object with the ones from your custom provider - be sure to give it a unique ID and specify the required URLs, and finally add it to the providers array when initializing the library:
-
-```js title="pages/api/auth/[...nextauth].js"
-import TwitterProvider from "next-auth/providers/twitter"
-...
-providers: [
- TwitterProvider({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET,
- }),
- {
- id: 'customProvider',
- name: 'CustomProvider',
- type: 'oauth',
- scope: '' // Make sure to request the users email address
- ...
- }
-]
-...
-```
-
-### Adding a new provider
-
-If you think your custom provider might be useful to others, we encourage you to open a PR and add it to the built-in list so others can discover it much more easily!
-
-You only need to add two changes:
-
-1. Add your config: [`src/providers/{provider}.js`](https://github.com/nextauthjs/next-auth/tree/main/src/providers)
- • make sure you use a named default export, like this: `export default function YourProvider`
-2. Add provider documentation: [`www/docs/providers/{provider}.md`](https://github.com/nextauthjs/next-auth/tree/main/www/docs/providers)
-
-That's it! 🎉 Others will be able to discover and use this provider much more easily now!
diff --git a/www/docs/contributors.md b/www/docs/contributors.md
deleted file mode 100644
index ae159c85e0..0000000000
--- a/www/docs/contributors.md
+++ /dev/null
@@ -1,29 +0,0 @@
----
-id: contributors
-title: Contributors
----
-
-## Core Team
-
-* [Iain Collins](https://github.com/iaincollins)
-* [Lori Karikari](https://github.com/LoriKarikari)
-* [Nico Domino](https://github.com/ndom91)
-* [Fredrik Pettersen](https://github.com/Fumler)
-* [Gerald Nolan](https://github.com/geraldnolan)
-* [Lluis Agusti](https://github.com/lluia)
-* [Jefferson Bledsoe](https://github.com/JeffersonBledsoe)
-* [Balázs Orbán](https://github.com/sponsors/balazsorban44)
-
-_Special thanks to Lori Karikari for creating most of the providers, to Nico Domino for creating this site, to Fredrik Pettersen for creating the Prisma adapter, to Gerald Nolan for adding support for Sign in with Apple, to Lluis Agusti for work to add TypeScript definitions and to Jefferson Bledsoe for working on automating testing._
-
-## Other Contributors
-
-NextAuth.js as it exists today has been possible thanks to the work of many individual contributors.
-
-Thank you to the [dozens of individual contributors](https://github.com/nextauthjs/next-auth/graphs/contributors) who have help shaped NextAuth.js.
-
-## History
-
-NextAuth.js was originally developed by Iain Collins in 2016.
-
-In 2020, NextAuth.js was rebuilt from the ground up to support Serverless, with support for MySQL, Postgres and MongoDB, JSON Web Tokens and built in support for over a dozen authentication providers.
diff --git a/www/docs/errors.md b/www/docs/errors.md
deleted file mode 100644
index 789a35b588..0000000000
--- a/www/docs/errors.md
+++ /dev/null
@@ -1,225 +0,0 @@
----
-id: errors
-title: Errors
----
-
-This is a list of errors output from NextAuth.js.
-
-All errors indicate an unexpected problem, you should not expect to see errors.
-
-If you are seeing any of these errors in the console, something is wrong.
-
----
-
-## Client
-
-These errors are returned from the client. As the client is [Universal JavaScript (or "Isomorphic JavaScript")](https://en.wikipedia.org/wiki/Isomorphic_JavaScript) it can be run on the client or server, so these errors can occur in both in the terminal and in the browser console.
-
-#### CLIENT_SESSION_ERROR
-
-This error occurs when the `SessionProvider` Context has a problem fetching session data.
-
-#### CLIENT_FETCH_ERROR
-
-If you see `CLIENT_FETCH_ERROR` make sure you have configured the `NEXTAUTH_URL` environment variable.
-
----
-
-## Server
-
-These errors are displayed on the terminal.
-
-### OAuth
-
-#### OAUTH_GET_ACCESS_TOKEN_ERROR
-
-This occurs when there was an error in the POST request to the OAuth provider and we were not able to retrieve the access token.
-
-Please double check your provider settings.
-
-#### OAUTH_V1_GET_ACCESS_TOKEN_ERROR
-
-This error is explicitly related to older OAuth v1.x providers, if you are using one of these, please double check all available settings.
-
-#### OAUTH_GET_PROFILE_ERROR
-
-N/A
-
-#### OAUTH_PARSE_PROFILE_ERROR
-
-This error is a result of either a problem with the provider response or the user cancelling the action with the provider, unfortunately we can't discern which with the information we have.
-
-This error should also log the exception and available `profileData` to further aid debugging.
-
-#### OAUTH_CALLBACK_HANDLER_ERROR
-
-This error will occur when there was an issue parsing the json request body, for example.
-
-There should also be further details logged when this occurs, such as the error thrown, and the request body itself to aid in debugging.
-
----
-
-### Signin / Callback
-
-#### GET_AUTHORIZATION_URL_ERROR
-
-This error can occur when we cannot get the OAuth v1 request token and generate the authorization URL.
-
-Please double check your OAuth v1 provider settings, especially the OAuth token and OAuth token secret.
-
-#### SIGNIN_OAUTH_ERROR
-
-This error can occur in one of a few places, first during the redirect to the authorization URL of the provider. Next, in the signin flow while creating the PKCE code verifier. Finally, during the generation of the CSRF Token hash in internal state during signin.
-
-Please check your OAuth provider settings and make sure your URLs and other options are correctly set on the provider side.
-
-#### CALLBACK_OAUTH_ERROR
-
-This can occur during handling of the callback if the `code_verifier` cookie was not found or an invalid state was returned from the OAuth provider.
-
-#### SIGNIN_EMAIL_ERROR
-
-This error can occur when a user tries to sign in via an email link; for example, if the email token could not be generated or the verification request failed.
-
-Please double check your email settings.
-
-#### CALLBACK_EMAIL_ERROR
-
-This can occur during the email callback process. Specifically, if there was an error signing the user in via email, encoding the jwt, etc.
-
-Please double check your Email settings.
-
-#### EMAIL_REQUIRES_ADAPTER_ERROR
-
-The Email authentication provider can only be used if a database is configured.
-
-#### CALLBACK_CREDENTIALS_JWT_ERROR
-
-The Credentials Provider can only be used if JSON Web Tokens are used for sessions.
-
-JSON Web Tokens are used for Sessions by default if you have not specified a database. However if you are using a database, then Database Sessions are enabled by default and you need to [explicitly enable JWT Sessions](https://next-auth.js.org/configuration/options#session) to use the Credentials Provider.
-
-If you are using a Credentials Provider, NextAuth.js will not persist users or sessions in a database - user accounts used with the Credentials Provider must be created and managed outside of NextAuth.js.
-
-In _most cases_ it does not make sense to specify a database in NextAuth.js options and support a Credentials Provider.
-
-#### CALLBACK_CREDENTIALS_HANDLER_ERROR
-
-This error occurs when there was no `authorize()` handler defined on the credential authentication provider.
-
-#### PKCE_ERROR
-
-The provider you tried to use failed when setting [PKCE or Proof Key for Code Exchange](https://tools.ietf.org/html/rfc7636#section-4.2).
-The `code_verifier` is saved in a cookie called (by default) `__Secure-next-auth.pkce.code_verifier` which expires after 15 minutes.
-Check if `cookies.pkceCodeVerifier` is configured correctly. The default `code_challenge_method` is `"S256"`. This is currently not configurable to `"plain"`, as it is not recommended, and in most cases it is only supported for backward compatibility.
-
----
-
-### Session Handling
-
-#### JWT_SESSION_ERROR
-
-https://next-auth.js.org/errors#jwt_session_error JWKKeySupport: the key does not support HS512 verify algorithm
-
-The algorithm used for generating your key isn't listed as supported. You can generate a HS512 key using
-
-```
- jose newkey -s 512 -t oct -a HS512
-```
-
-If you are unable to use an HS512 key (for example to interoperate with other services) you can define what is supported using
-
-```
- jwt: {
- signingKey: {"kty":"oct","kid":"--","alg":"HS256","k":"--"},
- verificationOptions: {
- algorithms: ["HS256"]
- }
- }
-```
-
-#### SESSION_ERROR
-
----
-
-### Signout
-
-#### SIGNOUT_ERROR
-
-This error occurs when there was an issue deleting the session from the database, for example.
-
----
-
-### Database
-
-These errors are logged by the TypeORM Adapter, which is the default database adapter.
-
-They all indicate a problem interacting with the database.
-
-#### ADAPTER_CONNECTION_ERROR
-
-This error can occur during the `createConnection()` function. Make sure your database connection string / settings are correct and the database is up and ready to receive connections.
-
-#### CREATE_USER_ERROR
-
-N/A
-
-#### GET_USER_BY_ID_ERROR
-
-N/A
-
-#### GET_USER_BY_EMAIL_ERROR
-
-N/A
-
-#### GET_USER_BY_PROVIDER_ACCOUNT_ID_ERROR
-
-N/A
-
-#### LINK_ACCOUNT_ERROR
-
-N/A
-
-#### CREATE_SESSION_ERROR
-
-N/A
-
-#### GET_SESSION_ERROR
-
-N/A
-
-#### UPDATE_SESSION_ERROR
-
-N/A
-
-#### DELETE_SESSION_ERROR
-
-N/A
-
-#### CREATE_VERIFICATION_REQUEST_ERROR
-
-N/A
-
-#### GET_VERIFICATION_REQUEST_ERROR
-
-N/A
-
-#### DELETE_VERIFICATION_REQUEST_ERROR
-
-N/A
-
----
-
-### Other
-
-#### SEND_VERIFICATION_EMAIL_ERROR
-
-This error occurs when the Email Authentication Provider is unable to send an email.
-
-Check your mail server configuration.
-
-#### MISSING_NEXTAUTH_API_ROUTE_ERROR
-
-This error happens when `[...nextauth].js` file is not found inside `pages/api/auth`.
-
-Make sure the file is there and the filename is written correctly.
diff --git a/www/docs/faq.md b/www/docs/faq.md
deleted file mode 100644
index 01a3439c02..0000000000
--- a/www/docs/faq.md
+++ /dev/null
@@ -1,384 +0,0 @@
----
-id: faq
-title: Frequently Asked Questions
----
-
-## About NextAuth.js
-
-### Is NextAuth.js commercial software?
-
-NextAuth.js is an open source project built by individual contributors.
-
-It is not commercial software and is not associated with a commercial organization.
-
----
-
-## Compatibility
-
-
-
-
What databases does NextAuth.js support?
-
-
-
-You can use NextAuth.js with MySQL, MariaDB, Postgres, MongoDB and SQLite or without a database. (See also: [Databases](/configuration/databases))
-
-You can use also NextAuth.js with any database using a custom database adapter, or by using a custom credentials authentication provider - e.g. to support signing in with a username and password stored in an existing database.
-
-
-
-
-
-
-
What authentication services does NextAuth.js support?
-
-
-
-
NextAuth.js includes built-in support for signing in with
-{Object.values(require("../providers.json")).sort().join(", ")}.
-(See also: Providers)
-
-
-NextAuth.js also supports email for passwordless sign in, which is useful for account recovery or for people who are not able to use an account with the configured OAuth services (e.g. due to service outage, account suspension or otherwise becoming locked out of an account).
-
-You can also use a custom based provider to support signing in with a username and password stored in an external database and/or using two factor authentication.
-
-
-
-
-
-
-
Does NextAuth.js support signing in with a username and password?
-
-
-
-NextAuth.js is designed to avoid the need to store passwords for user accounts.
-
-If you have an existing database of usernames and passwords, you can use a custom credentials provider to allow signing in with a username and password stored in an existing database.
-
-_If you use a custom credentials provider user accounts will not be persisted in a database by NextAuth.js (even if one is configured). The option to use JSON Web Tokens for session tokens (which allow sign in without using a session database) must be enabled to use a custom credentials provider._
-
-
-
-
-
-
-
Can I use NextAuth.js with a website that does not use Next.js?
-
-
-
-NextAuth.js is designed for use with Next.js and Serverless.
-
-If you are using a different framework for you website, you can create a website that handles sign in with Next.js and then access those sessions on a website that does not use Next.js as long as the websites are on the same domain.
-
-If you use NextAuth.js on a website with a different subdomain then the rest of your website (e.g. `auth.example.com` vs `www.example.com`) you will need to set a custom cookie domain policy for the Session Token cookie. (See also: [Cookies](/configuration/options#cookies))
-
-NextAuth.js does not currently support automatically signing into sites on different top level domains (e.g. `www.example.com` vs `www.example.org`) using a single session.
-
-
-
-
-
-
-
Can I use NextAuth.js with React Native?
-
-
-
-NextAuth.js is designed as a secure, confidential client and implements a server side authentication flow.
-
-It is not intended to be used in native applications on desktop or mobile applications, which typically implement public clients (e.g. with client / secrets embedded in the application).
-
-
-
-
-
-
-
Is NextAuth.js supporting TypeScript?
-
-
-
-Yes! Check out the [TypeScript docs](/getting-started/typescript)
-
-
-
-
----
-
-## Databases
-
-
-
-
What databases are supported by NextAuth.js?
-
-
-
-NextAuth.js can be used with MySQL, Postgres, MongoDB, SQLite and compatible databases (e.g. MariaDB, Amazon Aurora, Amazon DocumentDB…) or with no database.
-
-It also provides an Adapter API which allows you to connect it to any database.
-
-
-
-
-
-
-
What does NextAuth.js use databases for?
-
-
-
-Databases in NextAuth.js are used for persisting users, OAuth accounts, email sign in tokens and sessions.
-
-Specifying a database is optional if you don't need to persist user data or support email sign in. If you don't specify a database then JSON Web Tokens will be enabled for session storage and used to store session data.
-
-If you are using a database with NextAuth.js, you can still explicitly enable JSON Web Tokens for sessions (instead of using database sessions).
-
-
-
-
-
-
-
Should I use a database?
-
-
-
-- Using NextAuth.js without a database works well for internal tools - where you need to control who is able to sign in, but when you do not need to create user accounts for them in your application.
-
-- Using NextAuth.js with a database is usually a better approach for a consumer facing application where you need to persist accounts (e.g. for billing, to contact customers, etc).
-
-
-
-
-
-
-
What database should I use?
-
-
-
-Managed database solutions for MySQL, Postgres and MongoDB (and compatible databases) are well supported from cloud providers such as Amazon, Google, Microsoft and Atlas.
-
-If you are deploying directly to a particular cloud platform you may also want to consider serverless database offerings they have (e.g. [Amazon Aurora Serverless on AWS](https://aws.amazon.com/rds/aurora/serverless/)).
-
-
-
-
----
-
-## Security
-
-
-
-
I think I've found a security problem, what should I do?
-
-
-
-Less serious or edge case issues (e.g. queries about compatibility with optional RFC specifications) can be raised as public issues on GitHub.
-
-If you discover what you think may be a potentially serious security problem, please contact a core team member via a private channel (e.g. via email to me@iaincollins.com or info@balazsorban.com and yo@ndo.dev) or raise a public issue requesting someone get in touch with you via whatever means you prefer for more details.
-
-
-
-
-
-
-
What is the disclosure policy for NextAuth.js?
-
-
-
-We practice responsible disclosure.
-
-If you contact us regarding a potentially serious issue, we will endeavor to get back to you within 72 hours and to publish a fix within 30 days. We will responsibly disclose the issue (and credit you with your consent) once a fix to resolve the issue has been released - or after 90 days, which ever is sooner.
-
-
-
-
-
-
-
How do I get Refresh Tokens and Access Tokens for an OAuth account?
-
-
-
-NextAuth.js provides a solution for authentication, session management and user account creation.
-
-NextAuth.js records Refresh Tokens and Access Tokens on sign in (if supplied by the provider) and it will pass them, along with the User ID, Provider and Provider Account ID, to either:
-
-1. A database - if a database connection string is provided
-2. The JSON Web Token callback - if JWT sessions are enabled (e.g. if no database specified)
-
-You can then look them up from the database or persist them to the JSON Web Token.
-
-Note: NextAuth.js does not currently handle Access Token rotation for OAuth providers for you, however you can check out [this tutorial](/tutorials/refresh-token-rotation) if you want to implement it.
-
-
-
-
-
-
-
When I sign in with another account with the same email address, why are accounts not linked automatically?
-
-
-
-Automatic account linking on sign in is not secure between arbitrary providers - with the exception of allowing users to sign in via an email addresses as a fallback (as they must verify their email address as part of the flow).
-
-When an email address is associated with an OAuth account it does not necessarily mean that it has been verified as belonging to account holder — how email address verification is handled is not part of the OAuth specification and varies between providers (e.g. some do not verify first, some do verify first, others return metadata indicating the verification status).
-
-With automatic account linking on sign in, this can be exploited by bad actors to hijack accounts by creating an OAuth account associated with the email address of another user.
-
-For this reason it is not secure to automatically link accounts between arbitrary providers on sign in, which is why this feature is generally not provided by authentication service and is not provided by NextAuth.js.
-
-Automatic account linking is seen on some sites, sometimes insecurely. It can be technically possible to do automatic account linking securely if you trust all the providers involved to ensure they have securely verified the email address associated with the account, but requires placing trust (and transferring the risk) to those providers to handle the process securely.
-
-Examples of scenarios where this is secure include with an OAuth provider you control (e.g. that only authorizes users internal to your organization) or with a provider you explicitly trust to have verified the users email address.
-
-Automatic account linking is not a planned feature of NextAuth.js, however there is scope to improve the user experience of account linking and of handling this flow, in a secure way. Typically this involves providing a fallback option to sign in via email, which is already possible (and recommended), but the current implementation of this flow could be improved on.
-
-Providing support for secure account linking and unlinking of additional providers - which can only be done if a user is already signed in already - was originally a feature in v1.x but has not been present since v2.0, is planned to return in a future release.
-
-
-
-
----
-
-## Feature Requests
-
-
-
-
Why doesn't NextAuth.js support [a particular feature]?
-
-
-
-NextAuth.js is an open source project built by individual contributors who are volunteers writing code and providing support in their spare time.
-
-If you would like NextAuth.js to support a particular feature, the best way to help make it happen is to raise a feature request describing the feature and offer to work with other contributors to develop and test it.
-
-If you are not able to develop a feature yourself, you can offer to sponsor someone to work on it.
-
-
-
-
-
-
-
I disagree with a design decision, how can I change your mind?
-
-
-
-Product design decisions on NextAuth.js are made by core team members.
-
-You can raise suggestions as feature requests / requests for enhancement.
-
-Requests that provide the detail requested in the template and follow the format requested may be more likely to be supported, as additional detail prompted in the templates often provides important context.
-
-Ultimately if your request is not accepted or is not actively in development, you are always free to fork the project under the terms of the ISC License.
-
-
-
-
----
-
-## JSON Web Tokens
-
-
-
-
Does NextAuth.js use JSON Web Tokens?
-
-
-
-NextAuth.js supports both database session tokens and JWT session tokens.
-
-- If a database is specified, database session tokens will be used by default.
-- If no database is specified, JWT session tokens will be used by default.
-
-You can also choose to use JSON Web Tokens as session tokens with using a database, by explicitly setting the `session: { jwt: true }` option.
-
-
-
-
-
-
-
What are the advantages of JSON Web Tokens?
-
-
-
-JSON Web Tokens can be used for session tokens, but are also used for lots of other things, such as sending signed objects between services in authentication flows.
-
-- Advantages of using a JWT as a session token include that they do not require a database to store sessions, this can be faster and cheaper to run and easier to scale.
-
-- JSON Web Tokens in NextAuth.js are secured using cryptographic signing (JWS) by default and it is easy for services and API endpoints to verify tokens without having to contact a database to verify them.
-
-- You can enable encryption (JWE) to store include information directly in a JWT session token that you wish to keep secret and use the token to pass information between services / APIs on the same domain.
-
-- You can use JWT to securely store information you do not mind the client knowing even without encryption, as the JWT is stored in a server-readable-only-token so data in the JWT is not accessible to third party JavaScript running on your site.
-
-
-
-
-
-
-
What are the disadvantages of JSON Web Tokens?
-
-
-
-- You cannot as easily expire a JSON Web Token - doing so requires maintaining a server side blocklist of invalid tokens (at least until they expire) and checking every token against the list every time a token is presented.
-
- Shorter session expiry times are used when using JSON Web Tokens as session tokens to allow sessions to be invalidated sooner and simplify this problem.
-
- NextAuth.js client includes advanced features to mitigate the downsides of using shorter session expiry times on the user experience, including automatic session token rotation, optionally sending keep alive messages to prevent short lived sessions from expiring if there is an window or tab open, background re-validation, and automatic tab/window syncing that keeps sessions in sync across windows any time session state changes or a window or tab gains or loses focus.
-
-- As with database session tokens, JSON Web Tokens are limited in the amount of data you can store in them. There is typically a limit of around 4096 bytes per cookie, though the exact limit varies between browsers, proxies and hosting services. If you want to support most browsers, then do not exceed 4096 bytes per cookie. If you want to save more data, you will need to persist your sessions in a database (Source: [browsercookielimits.iain.guru](http://browsercookielimits.iain.guru/))
-
- The more data you try to store in a token and the more other cookies you set, the closer you will come to this limit. If you wish to store more than ~4 KB of data you're probably at the point where you need to store a unique ID in the token and persist the data elsewhere (e.g. in a server-side key/value store).
-
-- Data stored in an encrypted JSON Web Token (JWE) may be compromised at some point.
-
- Even if appropriately configured, information stored in an encrypted JWT should not be assumed to be impossible to decrypt at some point - e.g. due to the discovery of a defect or advances in technology.
-
- Avoid storing any data in a token that might be problematic if it were to be decrypted in the future.
-
-- If you do not explicitly specify a secret for for NextAuth.js, existing sessions will be invalidated any time your NextAuth.js configuration changes, as NextAuth.js will default to an auto-generated secret.
-
- If using JSON Web Token you should at least specify a secret and ideally configure public/private keys.
-
-
-
-
-
-
-
Are JSON Web Tokens secure?
-
-
-
-By default tokens are signed (JWS) but not encrypted (JWE), as encryption adds additional overhead and reduces the amount of space available to store data (total cookie size for a domain is limited to 4KB).
-
-- JSON Web Tokens in NextAuth.js use JWS and are signed using HS512 with an auto-generated key.
-
-- If encryption is enabled by setting `jwt: { encryption: true }` option then the JWT will _also_ use JWE to encrypt the token, using A256GCM with an auto-generated key.
-
-You can specify other valid algorithms - [as specified in RFC 7518](https://tools.ietf.org/html/rfc7517) - with either a secret (for symmetric encryption) or a public/private key pair (for a symmetric encryption).
-
-NextAuth.js will generate keys for you, but this will generate a warning at start up.
-
-Using explicit public/private keys for signing is strongly recommended.
-
-
-
-
-
-
-
What signing and encryption standards does NextAuth.js support?
-
-
-
-NextAuth.js includes a largely complete implementation of JSON Object Signing and Encryption (JOSE):
-
-- [RFC 7515 - JSON Web Signature (JWS)](https://tools.ietf.org/html/rfc7515)
-- [RFC 7516 - JSON Web Encryption (JWE)](https://tools.ietf.org/html/rfc7516)
-- [RFC 7517 - JSON Web Key (JWK)](https://tools.ietf.org/html/rfc7517)
-- [RFC 7518 - JSON Web Algorithms (JWA)](https://tools.ietf.org/html/rfc7518)
-- [RFC 7519 - JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519)
-
-This incorporates support for:
-
-- [RFC 7638 - JSON Web Key Thumbprint](https://tools.ietf.org/html/rfc7638)
-- [RFC 7787 - JSON JWS Unencoded Payload Option](https://tools.ietf.org/html/rfc7797)
-- [RFC 8037 - CFRG Elliptic Curve ECDH and Signatures](https://tools.ietf.org/html/rfc8037)
-
-
-
diff --git a/www/docs/getting-started/client.md b/www/docs/getting-started/client.md
deleted file mode 100644
index 45b283c081..0000000000
--- a/www/docs/getting-started/client.md
+++ /dev/null
@@ -1,516 +0,0 @@
----
-id: client
-title: Client API
----
-
-The NextAuth.js client library makes it easy to interact with sessions from React applications.
-
-#### Example Session Object
-
-```js
-{
- user: {
- name: string,
- email: string,
- image: uri
- },
- accessToken: string,
- expires: "YYYY-MM-DDTHH:mm:ss.SSSZ"
-}
-```
-
-:::tip
-The session data returned to the client does not contain sensitive information such as the Session Token or OAuth tokens. It contains a minimal payload that includes enough data needed to display information on a page about the user who is signed in for presentation purposes (e.g name, email, image).
-
-You can use the [session callback](/configuration/callbacks#session-callback) to customize the session object returned to the client if you need to return additional data in the session object.
-:::
-
----
-
-## useSession()
-
-- Client Side: **Yes**
-- Server Side: No
-
-The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
-
-Make sure that [``](#sessionprovider) is added to `pages/_app.js`.
-
-#### Example
-
-```jsx
-import { useSession } from "next-auth/react"
-
-export default function Component() {
- const { data: session, status } = useSession()
-
- if (status === "authenticated") {
- return
Signed in as {session.user.email}
- }
-
- return Sign in
-}
-```
-
-`useSession()` returns an object containing two values: `data` and `status`:
-
-- **`data`**: This can be three values: [`Session`](https://github.com/nextauthjs/next-auth/blob/8ff4b260143458c5d8a16b80b11d1b93baa0690f/types/index.d.ts#L437-L444) / `undefined` / `null`.
- - when the session hasn't been fetched yet, `data` will `undefined`
- - in case it failed to retrieve the session, `data` will be `null`
- - in case of success, `data` will be [`Session`](https://github.com/nextauthjs/next-auth/blob/8ff4b260143458c5d8a16b80b11d1b93baa0690f/types/index.d.ts#L437-L444).
-- **`status`**: enum mapping to three possible session states: `"loading" | "authenticated" | "unauthenticated"`
-
-### Require session
-
-Due to the way how Next.js handles `getServerSideProps` and `getInitialProps`, every protected page load has to make a server-side request to check if the session is valid and then generate the requested page (SSR). This increases server load, and if you are good with making the requests from the client, there is an alternative. You can use `useSession` in a way that makes sure you always have a valid session. If after the initial loading state there was no session found, you can define the appropriate action to respond.
-
-The default behavior is to redirect the user to the sign-in page, from where - after a successful login - they will be sent back to the page they started on. You can also define an `onFail()` callback, if you would like to do something else:
-
-#### Example
-
-```jsx title="pages/protected.jsx"
-import { useSession } from "next-auth/react"
-
-export default function Admin() {
- const { status } = useSession({
- required: true,
- onUnauthenticated() {
- // The user is not authenticated, handle it here.
- }
- })
-
- const if (status === "loading") {
- return "Loading or not authenticated..."
- }
-
- return "User is logged in"
-}
-```
-
----
-
-## getSession()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-NextAuth.js provides a `getSession()` method which can be called client or server side to return a session.
-
-It calls `/api/auth/session` and returns a promise with a session object, or null if no session exists.
-
-#### Client Side Example
-
-```js
-async function myFunction() {
- const session = await getSession()
- /* ... */
-}
-```
-
-#### Server Side Example
-
-```js
-import { getSession } from "next-auth/react"
-
-export default async (req, res) => {
- const session = await getSession({ req })
- /* ... */
- res.end()
-}
-```
-
-:::note
-When calling `getSession()` server side, you need to pass `{req}` or `context` object.
-:::
-
-The tutorial [securing pages and API routes](/tutorials/securing-pages-and-api-routes) shows how to use `getSession()` in server side calls.
-
----
-
-## getCsrfToken()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-The `getCsrfToken()` method returns the current Cross Site Request Forgery Token (CSRF Token) required to make POST requests (e.g. for signing in and signing out).
-
-You likely only need to use this if you are not using the built-in `signIn()` and `signOut()` methods.
-
-#### Client Side Example
-
-```js
-async function myFunction() {
- const csrfToken = await getCsrfToken()
- /* ... */
-}
-```
-
-#### Server Side Example
-
-```js
-import { getCsrfToken } from "next-auth/react"
-
-export default async (req, res) => {
- const csrfToken = await getCsrfToken({ req })
- /* ... */
- res.end()
-}
-```
-
----
-
-## getProviders()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-The `getProviders()` method returns the list of providers currently configured for sign in.
-
-It calls `/api/auth/providers` and returns a list of the currently configured authentication providers.
-
-It can be useful if you are creating a dynamic custom sign in page.
-
----
-
-#### API Route
-
-```jsx title="pages/api/example.js"
-import { getProviders } from "next-auth/react"
-
-export default async (req, res) => {
- const providers = await getProviders()
- console.log("Providers", providers)
- res.end()
-}
-```
-
-:::note
-Unlike `getSession()` and `getCsrfToken()`, when calling `getProviders()` server side, you don't need to pass anything, just as calling it client side.
-:::
-
----
-
-## signIn()
-
-- Client Side: **Yes**
-- Server Side: No
-
-Using the `signIn()` method ensures the user ends back on the page they started on after completing a sign in flow. It will also handle CSRF Tokens for you automatically when signing in with email.
-
-The `signIn()` method can be called from the client in different ways, as shown below.
-
-#### Redirects to sign in page when clicked
-
-```js
-import { signIn } from "next-auth/react"
-
-export default () =>
-```
-
-#### Starts Google OAuth sign-in flow when clicked
-
-```js
-import { signIn } from "next-auth/react"
-
-export default () => (
-
-)
-```
-
-#### Starts Email sign-in flow when clicked
-
-When using it with the email flow, pass the target `email` as an option.
-
-```js
-import { signIn } from "next-auth/react"
-
-export default ({ email }) => (
-
-)
-```
-
-#### Specifying a callbackUrl
-
-The `callbackUrl` specifies to which URL the user will be redirected after signing in. It defaults to the current URL of a user.
-
-You can specify a different `callbackUrl` by specifying it as the second argument of `signIn()`. This works for all providers.
-
-e.g.
-
-- `signIn(null, { callbackUrl: 'http://localhost:3000/foo' })`
-- `signIn('google', { callbackUrl: 'http://localhost:3000/foo' })`
-- `signIn('email', { email, callbackUrl: 'http://localhost:3000/foo' })`
-
-The URL must be considered valid by the [redirect callback handler](/configuration/callbacks#redirect-callback). By default it requires the URL to be an absolute URL at the same host name, or else it will redirect to the homepage. You can define your own [redirect callback](/configuration/callbacks#redirect-callback) to allow other URLs, including supporting relative URLs.
-
-#### Using the redirect: false option
-
-:::note
-The redirect option is only available for `credentials` and `email` providers.
-:::
-
-In some cases, you might want to deal with the sign in response on the same page and disable the default redirection. For example, if an error occurs (like wrong credentials given by the user), you might want to handle the error on the same page. For that, you can pass `redirect: false` in the second parameter object.
-
-e.g.
-
-- `signIn('credentials', { redirect: false, password: 'password' })`
-- `signIn('email', { redirect: false, email: 'bill@fillmurray.com' })`
-
-`signIn` will then return a Promise, that resolves to the following:
-
-```ts
-{
- /**
- * Will be different error codes,
- * depending on the type of error.
- */
- error: string | undefined
- /**
- * HTTP status code,
- * hints the kind of error that happened.
- */
- status: number
- /**
- * `true` if the signin was successful
- */
- ok: boolean
- /**
- * `null` if there was an error,
- * otherwise the url the user
- * should have been redirected to.
- */
- url: string | null
-}
-```
-
-#### Additional parameters
-
-It is also possible to pass additional parameters to the `/authorize` endpoint through the third argument of `signIn()`.
-
-See the [Authorization Request OIDC spec](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) for some ideas. (These are not the only possible ones, all parameters will be forwarded)
-
-e.g.
-
-- `signIn("identity-server4", null, { prompt: "login" })` _always ask the user to re-authenticate_
-- `signIn("auth0", null, { login_hint: "info@example.com" })` _hints the e-mail address to the provider_
-
-:::note
-You can also set these parameters through [`provider.authorizationParams`](/configuration/providers#oauth-provider-options).
-:::
-
-:::note
-The following parameters are always overridden server-side: `redirect_uri`, `state`
-:::
-
----
-
-## signOut()
-
-- Client Side: **Yes**
-- Server Side: No
-
-In order to logout, use the `signOut()` method to ensure the user ends back on the page they started on after completing the sign out flow. It also handles CSRF tokens for you automatically.
-
-It reloads the page in the browser when complete.
-
-```js
-import { signOut } from "next-auth/react"
-
-export default () =>
-```
-
-#### Specifying a callbackUrl
-
-As with the `signIn()` function, you can specify a `callbackUrl` parameter by passing it as an option.
-
-e.g. `signOut({ callbackUrl: 'http://localhost:3000/foo' })`
-
-The URL must be considered valid by the [redirect callback handler](/configuration/callbacks#redirect-callback). By default this means it must be an absolute URL at the same host name (or else it will default to the homepage); you can define your own custom [redirect callback](/configuration/callbacks#redirect-callback) to allow other URLs, including supporting relative URLs.
-
-#### Using the redirect: false option
-
-If you pass `redirect: false` to `signOut`, the page will not reload. The session will be deleted, and the `useSession` hook is notified, so any indication about the user will be shown as logged out automatically. It can give a very nice experience for the user.
-
-:::tip
-If you need to redirect to another page but you want to avoid a page reload, you can try:
-`const data = await signOut({redirect: false, callbackUrl: "/foo"})`
-where `data.url` is the validated URL you can redirect the user to without any flicker by using Next.js's `useRouter().push(data.url)`
-:::
-
----
-
-## SessionProvider
-
-Using the supplied `` allows instances of `useSession()` to share the session object across components, by using [React Context](https://reactjs.org/docs/context.html) under the hood. It also takes care of keeping the session updated and synced between tabs/windows.
-
-```jsx title="pages/_app.js"
-import { SessionProvider } from "next-auth/react"
-
-export default function App({
- Component,
- pageProps: { session, ...pageProps },
-}) {
- return (
-
-
-
- )
-}
-```
-
-If you pass the `session` page prop to the `` – as in the example above – you can avoid checking the session twice on pages that support both server and client side rendering.
-
-This only works on pages where you provide the correct `pageProps`, however. This is normally done in `getInitialProps` or `getServerSideProps` on an individual page basis like so:
-
-```js title="pages/index.js"
-import { getSession } from "next-auth/react"
-
-...
-
-export async function getServerSideProps(ctx) {
- return {
- props: {
- session: await getSession(ctx)
- }
- }
-}
-```
-
-If every one of your pages needs to be protected, you can do this in `getInitialProps` in `_app`, otherwise you can do it on a page-by-page basis. Alternatively, you can do per page authentication checks client side, instead of having each authentication check be blocking (SSR) by using the method described below in [alternative client session handling](#custom-client-session-handling).
-
-### Options
-
-The session state is automatically synchronized across all open tabs/windows and they are all updated whenever they gain or lose focus or the state changes in any of them (e.g. a user signs in or out).
-
-If you have session expiry times of 30 days (the default) or more then you probably don't need to change any of the default options in the Provider. If you need to, you can trigger an update of the session object across all tabs/windows by calling `getSession()` from a client side function.
-
-However, if you need to customize the session behavior and/or are using short session expiry times, you can pass options to the provider to customize the behavior of the `useSession()` hook.
-
-```jsx title="pages/_app.js"
-import { SessionProvider } from "next-auth/react"
-
-export default function App({
- Component,
- pageProps: { session, ...pageProps },
-}) {
- return (
-
-
-
- )
-}
-```
-
-:::note
-**These options have no effect on clients that are not signed in.**
-
-Every tab/window maintains its own copy of the local session state; the session is not stored in shared storage like localStorage or sessionStorage. Any update in one tab/window triggers a message to other tabs/windows to update their own session state.
-
-Using low values for `staleTime` or `refetchInterval` will increase network traffic and load on authenticated clients and may impact hosting costs and performance.
-:::
-
-#### Stale time
-
-The `staleTime` option is the maximum age a session data can be on the client before it is considered stale.
-
-When `staleTime` is set to `0` (the default) the cache will always be used when `useSession` is called and only explicit calls made to get the session status (i.e. `getSession()`) or event triggers, such as signing in or out in another tab/window, or a tab/window gaining or losing focus, will trigger an update of the session state.
-
-If set to any value other than zero, it specifies in seconds the maximum age of session data on the client before the `useSession()` hook will call the server again to sync the session state.
-
-Unless you have a short session expiry time (e.g. < 24 hours) you probably don't need to change this option. Setting this option to too short a value will increase load (and potentially hosting costs).
-
-The value for `staleTime` should always be lower than the value of the session `maxAge` [session option](/configuration/options#session).
-
-#### Refetch interval
-
-The `refetchInterval` option can be used to contact the server to avoid a session expiring.
-
-When `refetchInterval` is set to `0` (the default) there will be no session polling.
-
-If set to any value other than zero, it specifies in seconds how often the client should contact the server to update the session state. If the session state has expired when it is triggered, all open tabs/windows will be updated to reflect this.
-
-The value for `refetchInterval` should always be lower than the value of the session `maxAge` [session option](/configuration/options#session).
-
-:::note
-See [**the Next.js documentation**](https://nextjs.org/docs/advanced-features/custom-app) for more information on **\_app.js** in Next.js applications.
-:::
-
-## Alternatives
-
-### Custom Client Session Handling
-
-Due to the way Next.js handles `getServerSideProps` / `getInitialProps`, every protected page load has to make a server-side request to check if the session is valid and then generate the requested page. This alternative solution allows for showing a loading state on the initial check and every page transition afterward will be client-side, without having to check with the server and regenerate pages.
-
-```js title="pages/admin.jsx"
-export default function AdminDashboard() {
- const { data: session } = useSession()
- // session is always non-null inside this page, all the way down the React tree.
- return "Some super secret dashboard"
-}
-
-AdminDashboard.auth = true
-```
-
-```jsx title="pages/_app.jsx"
-export default function App({
- Component,
- pageProps: { session, ...pageProps },
-}) {
- return (
-
- {Component.auth ? (
-
-
-
- ) : (
-
- )}
-
- )
-}
-
-function Auth({ children }) {
- const { data: session, loading } = useSession()
- const isUser = !!session?.user
- React.useEffect(() => {
- if (loading) return // Do nothing while loading
- if (!isUser) signIn() // If not authenticated, force log in
- }, [isUser, loading])
-
- if (isUser) {
- return children
- }
-
- // Session is being fetched, or no user.
- // If no user, useEffect() will redirect.
- return
Loading...
-}
-```
-
-It can be easily be extended/modified to support something like an options object for role based authentication on pages. An example:
-
-```jsx title="pages/admin.jsx"
-AdminDashboard.auth = {
- role: "admin",
- loading: ,
- unauthorized: "/login-with-different-user", // redirect to this url
-}
-```
-
-Because of how `_app` is written, it won't unnecessarily contact the `/api/auth/session` endpoint for pages that do not require authentication.
-
-More information can be found in the following [GitHub Issue](https://github.com/nextauthjs/next-auth/issues/1210).
-
-### NextAuth.js + React-Query
-
-There is also an alternative client-side API library based upon [`react-query`](https://www.npmjs.com/package/react-query) available under [`nextauthjs/react-query`](https://github.com/nextauthjs/react-query).
-
-If you use `react-query` in your project already, you can leverage it with NextAuth.js to handle the client-side session management for you as well. This replaces NextAuth.js's native `useSession` and `SessionProvider` from `next-auth/react`.
-
-See repository [`README`](https://github.com/nextauthjs/react-query) for more details.
diff --git a/www/docs/getting-started/example.md b/www/docs/getting-started/example.md
deleted file mode 100644
index 7f26e42874..0000000000
--- a/www/docs/getting-started/example.md
+++ /dev/null
@@ -1,110 +0,0 @@
----
-id: example
-title: Example Code
----
-
-## Get started with NextAuth.js
-
-The example code below describes how to add authentication to a Next.js app.
-
-:::tip
-The easiest way to get started is to clone the [example app](https://github.com/nextauthjs/next-auth-example) and follow the instructions in README.md. You can try out a live demo at [next-auth-example.vercel.app](https://next-auth-example.vercel.app)
-:::
-
-### Add API route
-
-To add NextAuth.js to a project create a file called `[...nextauth].js` in `pages/api/auth`. NextAuth.js requires no modification to the `next.config.js` file.
-
-[Read more about how to add authentication providers.](/configuration/providers)
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-export default NextAuth({
- // Configure one or more authentication providers
- providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_ID,
- clientSecret: process.env.GITHUB_SECRET,
- }),
- // ...add more providers here
- ],
-})
-```
-
-All requests to `/api/auth/*` (`signIn`, callback, `signOut`, etc.) will automatically be handled by NextAuth.js.
-
-:::tip
-See the [options documentation](/configuration/options) for how to configure providers, databases and other options.
-:::
-
-### Add React Hook
-
-The [`useSession()`](http://localhost:3000/getting-started/client#usesession) React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
-
-```javascript
-import { useSession, signIn, signOut } from "next-auth/react"
-
-export default function Component() {
- const { data: session } = useSession()
- if (session) {
- return (
- <>
- Signed in as {session.user.email}
-
- >
- )
- }
- return (
- <>
- Not signed in
-
- >
- )
-}
-```
-
-:::tip
-You can use the `useSession` hook from anywhere in your application (e.g. in a header component).
-:::
-
-### Share/configure session state
-
-To be able to use `useSession` first you'll need to expose the session context, [``](http://localhost:3000/getting-started/client#sessionprovider), at the top level of your application:
-
-```javascript
-// pages/_app.js
-import { SessionProvider } from "next-auth/react"
-
-export default function App({
- Component,
- pageProps: { session, ...pageProps },
-}) {
- return (
-
-
-
- )
-}
-```
-
-In this way instances of `useSession` can have access to the session data and status, otherwise they'll throw an error... `` also takes care of keeping the session updated and synced between browser tabs and windows.
-
-:::tip
-Check out the [client documentation](/getting-started/client) to see how you can improve the user experience and page performance by using the NextAuth.js client.
-:::
-
-### Deploying to production
-
-When deploying your site set the `NEXTAUTH_URL` environment variable to the canonical URL of the website.
-
-```
-NEXTAUTH_URL=https://example.com
-```
-
-:::tip
-In production, this needs to be set as an environment variable on the service you use to deploy your app.
-
-To set environment variables on Vercel, you can use the [dashboard](https://vercel.com/dashboard) or the `vercel env pull` [command](https://vercel.com/docs/build-step#development-environment-variables).
-:::
diff --git a/www/docs/getting-started/introduction.md b/www/docs/getting-started/introduction.md
deleted file mode 100644
index 21fac35fcc..0000000000
--- a/www/docs/getting-started/introduction.md
+++ /dev/null
@@ -1,55 +0,0 @@
----
-id: introduction
-title: Introduction
----
-
-## About NextAuth.js
-
-NextAuth.js is a complete open source authentication solution for [Next.js](http://nextjs.org/) applications.
-
-It is designed from the ground up to support Next.js and Serverless.
-
-[Check out the example code](/getting-started/example) to see how easy it is to use NextAuth.js for authentication.
-
-### Flexible and easy to use
-
-- Designed to work with any OAuth service, it supports OAuth 1.0, 1.0A, 2.0 and OpenID Connect
-- Built-in support for [many popular sign-in services](/configuration/providers)
-- Supports email / passwordless authentication
-- Supports stateless authentication with any backend (Active Directory, LDAP, etc)
-- Supports both JSON Web Tokens and database sessions
-- Designed for Serverless but runs anywhere (AWS Lambda, Docker, Heroku, etc…)
-
-### Own your own data
-
-NextAuth.js can be used with or without a database.
-
-- An open source solution that allows you to keep control of your data
-- Supports Bring Your Own Database (BYOD) and can be used with any database
-- Built-in support for [MySQL, MariaDB, Postgres, SQL Server, MongoDB and SQLite](/configuration/databases)
-- Works great with databases from popular hosting providers
-- Can also be used _without a database_ (e.g. OAuth + JWT)
-
-_Note: Email sign in requires a database to be configured to store single-use verification tokens._
-
-### Secure by default
-
-- Promotes the use of passwordless sign in mechanisms
-- Designed to be secure by default and encourage best practice for safeguarding user data
-- Uses Cross Site Request Forgery Tokens on POST routes (sign in, sign out)
-- Default cookie policy aims for the most restrictive policy appropriate for each cookie
-- When JSON Web Tokens are enabled, they are signed by default (JWS) with HS512
-- Use JWT encryption (JWE) by setting the option `encryption: true` (defaults to A256GCM)
-- Auto-generates symmetric signing and encryption keys for developer convenience
-- Features tab/window syncing and keepalive messages to support short lived sessions
-- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org/)
-
-Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.
-
-## Credits
-
-NextAuth.js is an open source project that is only possible [thanks to contributors](/contributors).
-
-## Getting Started
-
-[Check out the example code](/getting-started/example) to see how easy it is to use NextAuth.js for authentication.
diff --git a/www/docs/getting-started/rest-api.md b/www/docs/getting-started/rest-api.md
deleted file mode 100644
index c693b79b65..0000000000
--- a/www/docs/getting-started/rest-api.md
+++ /dev/null
@@ -1,62 +0,0 @@
----
-id: rest-api
-title: REST API
----
-
-NextAuth.js exposes a REST API which is used by the NextAuth.js client.
-
-#### `GET` /api/auth/signin
-
-Displays the sign in page.
-
-#### `POST` /api/auth/signin/:provider
-
-Starts an OAuth signin flow for the specified provider.
-
-The POST submission requires CSRF token from `/api/auth/csrf`.
-
-#### `GET` /api/auth/callback/:provider
-
-Handles returning requests from OAuth services during sign in.
-
-For OAuth 2.0 providers that support the `checks: ["state"]` option, the state parameter is checked against the one that was generated when the sign in flow was started - this uses a hash of the CSRF token which MUST match for both the `POST` and `GET` calls during sign in.
-
-#### `GET` /api/auth/signout
-
-Displays the sign out page allowing the user to logout.
-
-#### `POST` /api/auth/signout
-
-Handles signing out - this is a `POST` submission to prevent malicious links from triggering signing a user out without their consent.
-
-The `POST` submission requires CSRF token from `/api/auth/csrf`.
-
-#### `GET` /api/auth/session
-
-Returns client-safe session object - or an empty object if there is no session.
-
-The contents of the session object that is returned are configurable with the session callback.
-
-#### `GET` /api/auth/csrf
-
-Returns object containing CSRF token. In NextAuth.js, CSRF protection is present on all authentication routes. It uses the "double submit cookie method", which uses a signed HttpOnly, host-only cookie.
-
-The CSRF token returned by this endpoint must be passed as form variable named `csrfToken` in all `POST` submissions to any API endpoint.
-
-#### `GET` /api/auth/providers
-
-Returns a list of configured OAuth services and details (e.g. sign in and callback URLs) for each service.
-
-It can be used to dynamically generate custom sign up pages and to check what callback URLs are configured for each OAuth provider that is configured.
-
----
-
-:::note
-The default base path is `/api/auth` but it is configurable by specifying a custom path in `NEXTAUTH_URL`
-
-e.g.
-
-`NEXTAUTH_URL=https://example.com/myapp/api/authentication`
-
-`/api/auth/signin` -> `/myapp/api/authentication/signin`
-:::
diff --git a/www/docs/getting-started/typescript.md b/www/docs/getting-started/typescript.md
deleted file mode 100644
index da4b79c693..0000000000
--- a/www/docs/getting-started/typescript.md
+++ /dev/null
@@ -1,139 +0,0 @@
----
-id: typescript
-title: TypeScript
----
-
-NextAuth.js comes with its own type definitions, so you can safely use it in your TypeScript projects. Even if you don't use TypeScript, IDEs like VSCode will pick this up, to provide you with a better developer experience. While you are typing, you will get suggestions about what certain objects/functions look like, and sometimes also links to documentation, examples and other useful resources.
-
-Check out the example repository showcasing how to use `next-auth` on a Next.js application with TypeScript:
-https://github.com/nextauthjs/next-auth-typescript-example
-
----
-
-## Adapters
-
-If you're writing your own custom Adapter, you can take advantage of the types to make sure your implementation conforms to what's expected:
-
-```ts
-import type { Adapter } from "next-auth/adapters"
-
-function MyAdapter(): Adapter {
- return {
- // your adapter methods here
- }
-}
-```
-
-When writing your own custom Adapter in plain JavaScript, note that you can use **JSDoc** to get helpful editor hints and auto-completion like so:
-
-```js
-/** @return { import("next-auth/adapters").Adapter } */
-function MyAdapter() {
- return {
- // your adapter methods here
- }
-}
-```
-
-:::note
-This will work in code editors with a strong TypeScript integration like VSCode or WebStorm. It might not work if you're using more lightweight editors like VIM or Atom.
-:::
-
-## Module Augmentation
-
-`next-auth` comes with certain types/interfaces, that are shared across submodules. Good examples are `Session` and `JWT`. Ideally, you should only need to create these types at a single place, and TS should pick them up in every location where they are referenced. Luckily, this is exactly what Module Augmentation can do for us. Define your shared interfaces in a single location, and get type-safety across your application, when you use `next-auth` (or one of its submodules).
-
-### Main module
-
-Let's look at `Session`:
-
-```ts title="pages/api/[...nextauth].ts"
-import NextAuth from "next-auth"
-
-export default NextAuth({
- callbacks: {
- session({ session, token, user }) {
- return session // The return type will match the one returned in `useSession()`
- },
- },
-})
-```
-
-```ts title="pages/index.ts"
-import { useSession } from "next-auth/react"
-
-export default function IndexPage() {
- // `session` will match the returned value of `callbacks.session()` from `NextAuth()`
- const { data: session } = useSession()
-
- return (
- // Your component
- )
-}
-```
-
-To extend/augment this type, create a `types/next-auth.d.ts` file in your project:
-
-```ts title="types/next-auth.d.ts"
-import NextAuth from "next-auth"
-
-declare module "next-auth" {
- /**
- * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
- */
- interface Session {
- user: {
- /** The user's postal address. */
- address: string
- }
- }
-}
-```
-
-#### Popular interfaces to augment
-
-Although you can augment almost anything, here are some of the more common interfaces that you might want to override in the `next-auth` module:
-
-```ts
-/**
- * The shape of the user object returned in the OAuth providers' `profile` callback,
- * or the second parameter of the `session` callback, when using a database.
- */
-interface User {}
-/**
- * Usually contains information about the provider being used
- * and also extends `TokenSet`, which is different tokens returned by OAuth Providers.
- */
-interface Account {}
-/** The OAuth profile returned from your provider */
-interface Profile {}
-```
-
-Make sure that the `types` folder is added to [`typeRoots`](https://www.typescriptlang.org/tsconfig/#typeRoots) in your project's `tsconfig.json` file.
-
-### Submodules
-
-The `JWT` interface can be found in the `next-auth/jwt` submodule:
-
-```ts title="types/next-auth.d.ts"
-declare module "next-auth/jwt" {
- /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
- interface JWT {
- /** OpenID ID Token */
- idToken?: string
- }
-}
-```
-
-### Useful links
-
-1. [TypeScript documentation: Module Augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
-2. [Digital Ocean: Module Augmentation in TypeScript](https://www.digitalocean.com/community/tutorials/typescript-module-augmentation)
-
-## Contributing
-
-Contributions of any kind are always welcome, especially for TypeScript. Please keep in mind that we are a small team working on this project in our free time. We will try our best to give support, but if you think you have a solution for a problem, please open a PR!
-
-:::note
-When contributing to TypeScript, if the actual JavaScript user API does not change in a breaking manner, we reserve the right to push any TypeScript change in a minor release. This is to ensure that we can keep us on a faster release cycle.
-:::
diff --git a/www/docs/getting-started/upgrade-to-v4.md b/www/docs/getting-started/upgrade-to-v4.md
deleted file mode 100644
index 5b76b6d6b8..0000000000
--- a/www/docs/getting-started/upgrade-to-v4.md
+++ /dev/null
@@ -1,214 +0,0 @@
----
-id: upgrade-v4
-title: Upgrade Guide (v4)
----
-
-NextAuth.js version 4 included a few breaking changes from the last major version (3.x). So we're here to help you upgrade your applications as smoothly as possible. It should be possible to upgrade from any version of 3.x to the latest 4 release by following the next few migration steps.
-
-### 1. Database Adapters
-
-You can find the official Adapters in the [nextauthjs/adapter](https://github.com/nextauthjs/adapters) repository. Although you can still [create your own](/tutorials/creating-a-database-adapter) with a new, [simplified Adapter API](https://github.com/nextauthjs/next-auth/pull/2361).
-
-1.1. If you use the built-in TypeORM or Prisma adapters, these have been removed from the core `next-auth` package to not balloon the package size for users who do not need a database. Thankfully the migration is super easy; you just need to install the external packages for your database and change the import in your `[...nextauth].js`.
-
-The `database` option is gone, you can do the following instead:
-
-```diff
-// [...nextauth].js
-import NextAuth from "next-auth"
-+ import TypeORMAdapter from "@next-auth/typeorm-legacy-adapter"
-
-...
-export default NextAuth({
-- database: "yourconnectionstring",
-+ adapter: TypeORMAdapter("yourconnectionstring")
-})
-```
-
-1.2. The `prisma-legacy` adapter has been removed, please use the [`@next-auth/prisma-adapter`](https:/npmjs.com/package/@next-auth/prisma-adapter) instead.
-
-1.3. The `typeorm-legacy` adapter will stay as-is for the time being, however we do aim to migrate this to individual lighter weight adapters for each database type in the future, or switch out `typeorm`.
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.8 and https://github.com/nextauthjs/next-auth/pull/2361
-
-#### 1.4 Adapter API
-
-The Adapter API has been rewritten and significantly simplified in NextAuth v4. The adapters now have less work to do as some functionality has been migrated to the core of NextAuth, like hashing the [verification token](/adapters/models/#verification-token).
-
-**This does not require any changes from the user**, however if you are an adapter maintainer or are interested in writing your own adapter, you can find more information about this change in https://github.com/nextauthjs/next-auth/pull/2361 and release https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.22.
-
-### 2. `next-auth/react`
-
-We've renamed the client-side import source to `next-auth/react`. To comply with this change, you will simply have to rename anywhere you were using `next-auth/client`.
-
-For example:
-
-```diff
-- import { useSession } from "next-auth/client"
-+ import { useSession } from "next-auth/react"
-```
-
-We've also made the following changes to the names of the exports:
-
-- `setOptions`: Not exposed anymore, use [`SessionProvider` props](https://next-auth.js.org/getting-started/client#options)
-- `options`: Not exposed anymore, [use `SessionProvider` props](https://next-auth.js.org/getting-started/client#options)
-- `session`: Renamed to `getSession`
-- `providers`: Renamed to `getProviders`
-- `csrfToken`: Renamed to `getCsrfToken`
-- `signin`: Renamed to `signIn`
-- `signout`: Renamed to `signOut`
-- `Provider`: Renamed to `SessionProvider`
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.12
-
-### 3. SessionProvider
-
-Version 4 makes using the `SessionProvider` mandatory. This means that you will have to wrap any part of your application using `useSession` in this provider, if you were not doing so already. The `SessionProvider` has also undergone a few further changes:
-
-- `Provider` is renamed to `SessionProvider`
-- The options prop is now flattened as the props of SessionProvider.
-- `clientMaxAge` has been renamed to `staleTime`.
-- `keepAlive` has been renamed to `refetchInterval`.
-
-The best practice for wrapping your app in Providers is to do so in your `pages/_app.jsx` file.
-
-An example use-case with these new changes:
-
-```jsx
-import { SessionProvider } from "next-auth/react"
-
-export default function App({
- Component,
- pageProps: { session, ...pageProps },
-}) {
- return (
- // `session` comes from `getServerSideProps` or `getInitialProps`.
- // Avoids flickering/session loading on first load.
-
-
-
- )
-}
-```
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.12
-
-### 4. Named Parameters
-
-We have changed the arguments to our callbacks to the named parameters pattern. This way you don't have to use dummy `_` placeholders or other tricks.
-
-### Callbacks
-
-The signatures for the callback methods now look like this:
-
-```diff
-- signIn(user, account, profileOrEmailOrCredentials)
-+ signIn({ user, account, profile, email, credentials })
-```
-
-```diff
-- redirect(url, baseUrl)
-+ redirect({ url, baseUrl })
-```
-
-```diff
-- session(session, tokenOrUser)
-+ session({ session, token, user })
-```
-
-```diff
-- jwt(token, user, account, OAuthProfile, isNewUser)
-+ jwt({ token, user, account, profile, isNewUser })
-```
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.17
-
-### Events
-
-Two event signatures changes to also use the named parameters pattern, `signOut` and `updateUser`.
-
-```diff
-// [...nextauth].js
-...
-events: {
-- signOut(tokenOrSession),
-+ signOut({ token, session }), // token if using JWT, session if DB persisted sessions.
-- updateUser(user)
-+ updateUser({ user })
-}
-```
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.20
-
-### 5. useSession Hook
-
-The `useSession` hook has been updated to return an object. This allows you to test states much more cleanly with the new `status` option.
-
-```diff
-- const [ session, loading ] = useSession()
-+ const { data: session, status } = useSession()
-+ const loading = status === "loading"
-```
-
-[Check the docs](https://next-auth.js.org/getting-started/client#usesession) for the possible values of both `session.status` and `session.data`.
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.18
-
-### 6. `nodemailer`
-
-[`nodemailer`](https://npmjs.com/package/nodemailer) is no longer a dependency added by default. If you are using the Email provider you can install it in your project manually, or use any other Email library in the [`sendVerificationRequest`](/configuration/providers#options-1#:~:text=sendVerificationRequest) callback. This reduces bundle size for those not actually using the Email provider.
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.2
-
-### 7. Logger API
-
-The logger API has been simplified to use at most two parameters, where the second is usually an object (`metadata`) containing an `error` object. If you are not using the logger settings you can ignore this change.
-
-```diff
-// [...nextauth.js]
-import log from "some-logger-service"
-...
-logger: {
-- error(code, ...message) {},
-+ error(code, metadata) {},
-- warn(code, ...message) {},
-+ warn(code) {}
-- debug(code, ...message) {}
-+ debug(code, metadata) {}
-}
-```
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.19
-
-### 8. Providers
-
-Importing OAuth providers has changed a bit, they now need to be individually imported.
-
-```diff
-- import Provider from "next-auth/providers"
-- Providers.Auth0({...})
-+ import Auth0Provider from "next-auth/providers/auth0"
-+ Auth0Provider({...})
-```
-
-> 1. The `AzureADB2C` provider has been renamed `AzureAD`.
-> 2. The `Basecamp` provider has been removed, see explanation [here](https://github.com/basecamp/api/blob/master/sections/authentication.md#on-authenticating-users-via-oauth).
-> 3. The GitHub provider by default now will not request full write access to user profiles. If you need this scope, please add `user` to the scope option manually.
-
-The following new options are available when defining your Providers in the configuration:
-
-1. `authorization` (replaces `authorizationUrl`, `authorizationParams`, `scope`)
-2. `token` replaces (`accessTokenUrl`, `headers`, `params`)
-3. `userinfo` (replaces `profileUrl`)
-
-Read more about it in this PR: (next-auth#2411)[https://github.com/nextauthjs/next-auth/pull/2411#issue-693918157]
-
-When submitting a new OAuth provider to the repository, the `profile` callback is expected to only return these fields from now on: `id`, `name`, `email`, and `image`. If any of these are missing values, they should be set to `null`.
-
-Also worth noting that the `id` is expected to be returned as a `string` type (For example if your provider returns it as a number, you can simply cast it by the `.toString()` method). This makes the returned profile comply across providers/accounts/adapters, and will hopefully cause less confusion.
-
-Introduced in https://github.com/nextauthjs/next-auth/releases/tag/v4.0.0-next.20
-
-## Summary
-
-We hope this migration goes smoothly for each and every one of you! If you have any questions or get stuck anywhere, feel free to create [a new issue](https://github.com/nextauthjs/next-auth/issues/new) on GitHub.
diff --git a/www/docs/providers/42.md b/www/docs/providers/42.md
deleted file mode 100644
index 3f5b5accc2..0000000000
--- a/www/docs/providers/42.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: 42-school
-title: 42 School
----
-
-## Documentation
-
-https://api.intra.42.fr/apidoc/guides/web_application_flow
-
-## Configuration
-
-https://profile.intra.42.fr/oauth/applications/new
-
-## Options
-
-The **42 School Provider** comes with a set of default options:
-
-- [42 School Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/42.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FortyTwo({
- clientId: process.env.FORTY_TWO_CLIENT_ID,
- clientSecret: process.env.FORTY_TWO_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/apple.md b/www/docs/providers/apple.md
deleted file mode 100644
index a88de53c90..0000000000
--- a/www/docs/providers/apple.md
+++ /dev/null
@@ -1,209 +0,0 @@
----
-id: apple
-title: Apple
----
-
-## Documentation
-
-https://developer.apple.com/sign-in-with-apple/get-started/
-
-## Configuration
-
-https://developer.apple.com/account/resources/identifiers/list/serviceId
-
-## Options
-
-The **Apple Provider** comes with a set of default options:
-
-- [Apple Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/apple.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-There are two ways you can use the Sign in with Apple provider.
-
-### Dynamically generated secret
-
-If you use a dynamically generated secret you never have to manually update the server.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Apple({
- clientId: process.env.APPLE_ID,
- clientSecret: {
- teamId: process.env.APPLE_TEAM_ID,
- privateKey: process.env.APPLE_PRIVATE_KEY,
- keyId: process.env.APPLE_KEY_ID,
- }
- })
-]
-...
-```
-
-:::tip
-
-You can convert your Apple key to a single line to use it in an environment variable.
-
-**Mac**
-
-```bash
-awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' AuthKey_ID.k8
-```
-
-**Windows**
-
-```powershell
- $k8file = "AuthKey_ID.k8"
-(Get-Content "C:\Users\$env:UserName\Downloads\${k8file}") -join "\n"
-```
-
-:::
-
-### Pre-generated secret
-
-If you use a pre-generated secret you can avoid adding your private key as an environment variable.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Apple({
- clientId: process.env.APPLE_ID,
- clientSecret: process.env.APPLE_KEY_SECRET
- })
-]
-...
-```
-
-:::tip
-The TeamID is located on the top right after logging in.
-:::
-
-:::tip
-The KeyID is located after you create the Key look for before you download the k8 file.
-:::
-
-## Instructions
-
-### Testing
-
-:::tip
-Apple requires all sites to run HTTPS (including local development instances).
-:::
-
-:::tip
-Apple doesn't allow you to use localhost in domains or subdomains.
-:::
-
-The following guides may be helpful:
-
-- [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
-
-- [Guide to configuring Sign in with Apple](https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple)
-
-### Example server
-
-You will need to edit your host file and point your site at `127.0.0.1`
-
-[How to edit my host file?](https://phoenixnap.com/kb/how-to-edit-hosts-file-in-windows-mac-or-linux)
-
-On Windows (Run Powershell as administrator)
-
-```ps
-Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tdev.example.com" -Force
-```
-
-```
-127.0.0.1 dev.example.com
-```
-
-#### Create certificate
-
-Creating a certificate for localhost is easy with openssl . Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
-
-```bash
-openssl req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost' -extensions EXT -config <( \
- printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
-```
-
-:::tip
-**Windows**
-
-The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
-Once installed you will find the openssl.exe file in `C:/Program Files/Git/mingw64/bin` which you can add to the system PATH environment variable if it’s not already done.
-
-Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf`
-
-```bash
- req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost'
-```
-
-:::
-
-Create directory `certificates` and place `localhost.key` and `localhost.crt`
-
-You can create a `server.js` in the root of your project and run it with `node server.js` to test Sign in with Apple integration locally:
-
-```js
-const { createServer } = require("https")
-const { parse } = require("url")
-const next = require("next")
-const fs = require("fs")
-
-const dev = process.env.NODE_ENV !== "production"
-const app = next({ dev })
-const handle = app.getRequestHandler()
-
-const httpsOptions = {
- key: fs.readFileSync("./certificates/localhost.key"),
- cert: fs.readFileSync("./certificates/localhost.crt"),
-}
-
-app.prepare().then(() => {
- createServer(httpsOptions, (req, res) => {
- const parsedUrl = parse(req.url, true)
- handle(req, res, parsedUrl)
- }).listen(3000, (err) => {
- if (err) throw err
- console.log("> Ready on https://localhost:3000")
- })
-})
-```
-
-### Example JWT code
-
-If you want to pre-generate your secret, this is an example of the code you will need:
-
-```js
-const jwt = require("jsonwebtoken")
-const fs = require("fs")
-
-const appleId = "myapp.example.com"
-const keyId = ""
-const teamId = ""
-const privateKey = fs.readFileSync("path/to/key")
-
-const secret = jwt.sign(
- {
- iss: teamId,
- iat: Math.floor(Date.now() / 1000),
- exp: Math.floor(Date.now() / 1000) + 86400 * 180, // 6 months
- aud: "https://appleid.apple.com",
- sub: appleId,
- },
- privateKey,
- {
- algorithm: "ES256",
- keyid: keyId,
- }
-)
-
-console.log(secret)
-```
diff --git a/www/docs/providers/atlassian.md b/www/docs/providers/atlassian.md
deleted file mode 100644
index f82d991bd0..0000000000
--- a/www/docs/providers/atlassian.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-id: atlassian
-title: Atlassian
----
-
-## Documentation
-
-https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo-
-
-## Options
-
-The **Atlassian Provider** comes with a set of default options:
-
-- [Atlassian Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/atlassian.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Atlassian({
- clientId: process.env.ATLASSIAN_CLIENT_ID,
- clientSecret: process.env.ATLASSIAN_CLIENT_SECRET,
- scope: 'write:jira-work read:jira-work read:jira-user offline_access read:me'
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-:::tip
-An app can be created at https://developer.atlassian.com/apps/
-:::
-
-Under "Apis and features" in the side menu, configure the following for "OAuth 2.0 (3LO)":
-
-- Redirect URL
- - http://localhost:3000/api/auth/callback/atlassian
-
-:::warning
-To enable access to Jira Platform REST API you must enable User Identity API and add `read:me` to your provider scope option.
-:::
diff --git a/www/docs/providers/auth0.md b/www/docs/providers/auth0.md
deleted file mode 100644
index 576414fb99..0000000000
--- a/www/docs/providers/auth0.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: auth0
-title: Auth0
----
-
-## Documentation
-
-https://auth0.com/docs/api/authentication#authorize-application
-
-## Configuration
-
-https://manage.auth0.com/dashboard
-
-:::tip
-Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App').
-:::
-
-## Options
-
-The **Auth0 Provider** comes with a set of default options:
-
-- [Auth0 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/auth0.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Auth0({
- clientId: process.env.AUTH0_CLIENT_ID,
- clientSecret: process.env.AUTH0_CLIENT_SECRET,
- domain: process.env.AUTH0_DOMAIN
- })
-]
-...
-```
-
-:::note
-`domain` should be the fully qualified domain – e.g. `dev-s6clz2lv.eu.auth0.com`
-:::
diff --git a/www/docs/providers/azure-ad-b2c.md b/www/docs/providers/azure-ad-b2c.md
deleted file mode 100644
index b6d934ca13..0000000000
--- a/www/docs/providers/azure-ad-b2c.md
+++ /dev/null
@@ -1,106 +0,0 @@
----
-id: azure-ad-b2c
-title: Azure Active Directory B2C
----
-
-## Documentation
-
-https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow
-
-## Configuration
-
-https://docs.microsoft.com/azure/active-directory-b2c/tutorial-create-tenant
-
-## Options
-
-The **Azure Active Directory Provider** comes with a set of default options:
-
-- [Azure Active Directory Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/azure-ad-b2c.js)
-
-You can override any of the options to suit your own use case.
-
-## Configuration (Basic)
-
-Basic configuration sets up Azure AD B2C to return an ID Token. This should be done as a prerequisite prior to running through the Advanced configuration.
-
-Step 1: Azure AD B2C Tenant
-https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant
-
-Step 2: App Registration
-https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications
-
-Step 3: User Flow
-https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-user-flows
-
-Note: For the step "User attributes and token claims" you might minimally:
-- Collect attribute:
- - Email Address
- - Display Name
- - Given Name
- - Surname
-- Return claim:
- - Email Addresses
- - Display Name
- - Given Name
- - Surname
- - Identity Provider
- - Identity Provider Access Token
- - User's Object ID
-
-## Example
-
-In `.env.local` create the following entries:
-
-```
-AZURE_AD_B2C_TENANT_NAME=
-AZURE_AD_B2C_CLIENT_ID=
-AZURE_AD_B2C_CLIENT_SECRET=
-AZURE_AD_B2C_PRIMARY_USER_FLOW=
-```
-
-In `pages/api/auth/[...nextauth].js` find or add the AZURE_AD_B2C entries:
-
-```js
-import Providers from 'next-auth/providers';
-...
-providers: [
- Providers.AzureADB2C({
- tenantName: process.env.AZURE_AD_B2C_TENANT_NAME,
- clientId: process.env.AZURE_AD_B2C_CLIENT_ID,
- clientSecret: process.env.AZURE_AD_B2C_CLIENT_SECRET,
- primaryUserFlow: process.env.AZURE_AD_B2C_PRIMARY_USER_FLOW,
- scope: `offline_access openid`,
- }),
-]
-...
-
-```
-
-## Configuration (Advanced)
-
-Advanced configuration sets up Azure AD B2C to return an Authorization Token. This builds on the steps completed in the Basic configuration above.
-
-Step 4: Add a Web API application
-https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-single-page-app-webapi?tabs=app-reg-ga
-
-Note: this is a second app registration (similar to Step 2) but with different setup and configuration.
-
-## Example
-
-Nothing in `.env.local` needs to change here. The only update is in `pages/api/auth/[...nextauth].js` where you will need to add the additional scopes that were created in Step 4 above:
-
-```js
-import Providers from 'next-auth/providers';
-...
-providers: [
- Providers.AzureADB2C({
- tenantName: process.env.AZURE_AD_B2C_TENANT_NAME,
- clientId: process.env.AZURE_AD_B2C_CLIENT_ID,
- clientSecret: process.env.AZURE_AD_B2C_CLIENT_SECRET,
- primaryUserFlow: process.env.AZURE_AD_B2C_PRIMARY_USER_FLOW,
- scope: `https://${process.env.AZURE_AD_B2C_TENANT_NAME}.onmicrosoft.com/api/demo.read https://${process.env.AZURE_AD_B2C_TENANT_NAME}.onmicrosoft.com/api/demo.write offline_access openid`,
- }),
-]
-...
-
-```
diff --git a/www/docs/providers/azure-ad.md b/www/docs/providers/azure-ad.md
deleted file mode 100644
index 4b2411fbfc..0000000000
--- a/www/docs/providers/azure-ad.md
+++ /dev/null
@@ -1,53 +0,0 @@
----
-id: azure-ad
-title: Azure Active Directory
----
-
-## Documentation
-
-https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
-
-## Configuration
-
-https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
-
-## Example
-
-### To allow specific Active Directory users access:
-- In https://portal.azure.com/ -> Azure Active Directory create a new App Registration.
-- Pay close attention to "Who can use this application or access this API?"
- - This allows you to scope access to specific types of user accounts.
-- Make sure to remember / copy
- - Application (client) ID
- - Directory (tenant) ID
-- When asked for a redirection URL, use http://localhost:3000/api/auth/callback/azure-ad
-- Create a new secret and remember / copy its value immediately, it will disappear.
-
-In `.env.local` create the follwing entries:
-
-```
-AZURE_AD_CLIENT_ID=
-AZURE_AD_CLIENT_SECRET=
-AZURE_AD_TENANT_ID=
-```
-**Note**: Omit the `AZURE_TENANT_ID` if you created the App Registration for:
-> Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)
-
-That will default the tenant to use the `common` authorization endpoint. [For more details see here](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints).
-
-In `pages/api/auth/[...nextauth].js` find or add the `AzureAD` entries:
-
-```js
-import Providers from 'next-auth/providers';
-...
-providers: [
- Providers.AzureAD({
- clientId: process.env.AZURE_AD_CLIENT_ID,
- clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
- tenantId: process.env.AZURE_AD_TENANT_ID, // omit this if it was omitted above.
- scope: 'offline_access User.Read',
- }),
-]
-...
-
-```
diff --git a/www/docs/providers/battlenet.md b/www/docs/providers/battlenet.md
deleted file mode 100644
index 569efad2cd..0000000000
--- a/www/docs/providers/battlenet.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-id: battle.net
-title: Battle.net
----
-
-## Documentation
-
-https://develop.battle.net/documentation/guides/using-oauth
-
-## Configuration
-
-https://develop.battle.net/access/clients
-
-## Options
-
-The **Battle.net Provider** comes with a set of default options:
-
-- [Battle.net Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/battlenet.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.BattleNet({
- clientId: process.env.BATTLENET_CLIENT_ID,
- clientSecret: process.env.BATTLENET_CLIENT_SECRET,
- region: process.env.BATTLENET_REGION
- })
-]
-...
-```
diff --git a/www/docs/providers/box.md b/www/docs/providers/box.md
deleted file mode 100644
index 42935dc99d..0000000000
--- a/www/docs/providers/box.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: box
-title: Box
----
-
-## Documentation
-
-https://developer.box.com/reference/
-
-## Configuration
-
-https://developer.box.com/guides/sso-identities-and-app-users/connect-okta-to-app-users/configure-box/
-
-## Options
-
-The **Box Provider** comes with a set of default options:
-
-- [Box Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/box.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Box({
- clientId: process.env.BOX_CLIENT_ID,
- clientSecret: process.env.BOX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/bungie.md b/www/docs/providers/bungie.md
deleted file mode 100644
index 2ea3662a4f..0000000000
--- a/www/docs/providers/bungie.md
+++ /dev/null
@@ -1,137 +0,0 @@
----
-id: bungie
-title: Bungie
----
-
-## Documentation
-
-https://github.com/Bungie-net/api/wiki/OAuth-Documentation
-
-## Configuration
-
-https://www.bungie.net/en/Application
-
-## Options
-
-The **Bungie Provider** comes with a set of default options:
-
-- [Bungie Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/bungie.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Bungie({
- clientId: process.env.BUNGIE_CLIENT_ID,
- clientSecret: process.env.BUNGIE_SECRET,
- headers: {
- 'X-API-Key': provess.env.BUNGIE_API_KEY
- }
- }),
-]
-...
-```
-
-### Configuration
-
-:::tip
-Bungie requires all sites to run HTTPS (including local development instances).
-:::
-
-:::tip
-Bungie doesn't allow you to use localhost as the website URL, instead you need to use https://127.0.0.1:3000
-:::
-
-Navigate to https://www.bungie.net/en/Application and fill in the required details:
-
-- Application name
-- Application Status
-- Website
-- OAuth Client Type
- - Confidential
-- Redirect URL
- - https://localhost:3000/api/auth/callback/bungie
-- Scope
- - `Access items like your Bungie.net notifications, memberships, and recent Bungie.Net forum activity.`
-- Origin Header
-
-The following guide may be helpful:
-
-- [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
-
-### Example server
-
-You will need to edit your host file and point your site at `127.0.0.1`
-
-[How to edit my host file?](https://phoenixnap.com/kb/how-to-edit-hosts-file-in-windows-mac-or-linux)
-
-On Windows (Run Powershell as administrator)
-
-```ps
-Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tdev.example.com" -Force
-```
-
-```
-127.0.0.1 dev.example.com
-```
-
-#### Create certificate
-
-Creating a certificate for localhost is easy with openssl. Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
-
-```bash
-openssl req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost' -extensions EXT -config <( \
- printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
-```
-
-:::tip
-**Windows**
-
-The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
-Once installed you will find the openssl.exe file in `C:/Program Files/Git/mingw64/bin` which you can add to the system PATH environment variable if it’s not already done.
-
-Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf`
-
-```bash
- req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost'
-```
-
-:::
-
-Create directory `certificates` and place `localhost.key` and `localhost.crt`
-
-You can create a `server.js` in the root of your project and run it with `node server.js` to test Sign in with Bungie integration locally:
-
-```js
-const { createServer } = require("https")
-const { parse } = require("url")
-const next = require("next")
-const fs = require("fs")
-
-const dev = process.env.NODE_ENV !== "production"
-const app = next({ dev })
-const handle = app.getRequestHandler()
-
-const httpsOptions = {
- key: fs.readFileSync("./certificates/localhost.key"),
- cert: fs.readFileSync("./certificates/localhost.crt"),
-}
-
-app.prepare().then(() => {
- createServer(httpsOptions, (req, res) => {
- const parsedUrl = parse(req.url, true)
- handle(req, res, parsedUrl)
- }).listen(3000, (err) => {
- if (err) throw err
- console.log("> Ready on https://localhost:3000")
- })
-})
-```
diff --git a/www/docs/providers/cognito.md b/www/docs/providers/cognito.md
deleted file mode 100644
index 152a2e53c8..0000000000
--- a/www/docs/providers/cognito.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: cognito
-title: Amazon Cognito
----
-
-## Documentation
-
-https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html
-
-## Configuration
-
-https://console.aws.amazon.com/cognito/users/
-
-You need to select your AWS region to go the the Cognito dashboard.
-
-## Options
-
-The **Amazon Cognito Provider** comes with a set of default options:
-
-- [Amazon Cognito Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/cognito.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Cognito({
- clientId: process.env.COGNITO_CLIENT_ID,
- clientSecret: process.env.COGNITO_CLIENT_SECRET,
- domain: process.env.COGNITO_DOMAIN,
- })
-]
-...
-```
-
-:::warning
-Make sure you select all the appropriate client settings or the OAuth flow will not work.
-:::
-
-![cognito](https://user-images.githubusercontent.com/7902980/83951604-cd096e80-a832-11ea-8bd2-c496ec9a16cb.PNG)
diff --git a/www/docs/providers/coinbase.md b/www/docs/providers/coinbase.md
deleted file mode 100644
index 18873cf0a1..0000000000
--- a/www/docs/providers/coinbase.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: coinbase
-title: Coinbase
----
-
-## Documentation
-
-https://developers.coinbase.com/api/v2
-
-## Configuration
-
-https://www.coinbase.com/settings/api
-
-## Options
-
-The **Coinbase Provider** comes with a set of default options:
-
-- [Coinbase Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/coinbase.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Coinbase({
- clientId: process.env.COINBASE_CLIENT_ID,
- clientSecret: process.env.COINBASE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-This Provider template has a 2 hour access token to it. A refresh token is also returned.
-:::
diff --git a/www/docs/providers/credentials.md b/www/docs/providers/credentials.md
deleted file mode 100644
index 05a8f15d01..0000000000
--- a/www/docs/providers/credentials.md
+++ /dev/null
@@ -1,144 +0,0 @@
----
-id: credentials
-title: Credentials
----
-
-## Overview
-
-The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, domain, or two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
-
-It is intended to support use cases where you have an existing system you need to authenticate users against.
-
-It comes with the constraint that users authenticated in this manner are not persisted in the database, and consequently that the Credentials provider can only be used if JSON Web Tokens are enabled for sessions.
-
-:::note
-The functionality provided for credentials based authentication is intentionally limited to discourage use of passwords due to the inherent security risks associated with them and the additional complexity associated with supporting usernames and passwords.
-:::
-
-## Options
-
-The **Credentials Provider** comes with a set of default options:
-
-- [Credentials Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/credentials.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-The Credentials provider is specified like other providers, except that you need to define a handler for `authorize()` that accepts credentials submitted via HTTP POST as input and returns either:
-
-1. A `user` object, which indicates the credentials are valid.
-
-If you return an object it will be persisted to the JSON Web Token and the user will be signed in, unless a custom `signIn()` callback is configured that subsequently rejects it.
-
-2. If you return `null` then an error will be displayed advising the user to check their details.
-
-3. If you throw an Error, the user will be sent to the error page with the error message as a query parameter.
-
-The Credentials provider's `authorize()` method also provides the request object as the second parameter (see example below).
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Credentials({
- // The name to display on the sign in form (e.g. 'Sign in with...')
- name: 'Credentials',
- // The credentials is used to generate a suitable form on the sign in page.
- // You can specify whatever fields you are expecting to be submitted.
- // e.g. domain, username, password, 2FA token, etc.
- credentials: {
- username: { label: "Username", type: "text", placeholder: "jsmith" },
- password: { label: "Password", type: "password" }
- },
- async authorize(credentials, req) {
- // Add logic here to look up the user from the credentials supplied
- const user = { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
-
- if (user) {
- // Any object returned will be saved in `user` property of the JWT
- return user
- } else {
- // If you return null or false then the credentials will be rejected
- return null
- // You can also Reject this callback with an Error or with a URL:
- // throw new Error('error message') // Redirect to error page
- // throw '/path/to/redirect' // Redirect to a URL
- }
- }
- })
-]
-...
-```
-
-See the [callbacks documentation](/configuration/callbacks) for more information on how to interact with the token.
-
-## Multiple providers
-
-### Example code
-
-You can specify more than one credentials provider by specifying a unique `id` for each one.
-
-You can also use them in conjunction with other provider options.
-
-As with all providers, the order you specify them is the order they are displayed on the sign in page.
-
-```js
-providers: [
- Providers.Credentials({
- id: "domain-login",
- name: "Domain Account",
- async authorize(credentials, req) {
- const user = {
- /* add function to get user */
- }
- return user
- },
- credentials: {
- domain: {
- label: "Domain",
- type: "text ",
- placeholder: "CORPNET",
- value: "CORPNET",
- },
- username: { label: "Username", type: "text ", placeholder: "jsmith" },
- password: { label: "Password", type: "password" },
- },
- }),
- Providers.Credentials({
- id: "intranet-credentials",
- name: "Two Factor Auth",
- async authorize(credentials, req) {
- const user = {
- /* add function to get user */
- }
- return user
- },
- credentials: {
- email: { label: "Username", type: "text ", placeholder: "jsmith" },
- "2fa-key": { label: "2FA Key" },
- },
- }),
- /* ... additional providers ... /*/
-]
-```
-
-### Example UI
-
-This example below shows a complex configuration is rendered by the built in sign in page.
-
-You can also [use a custom sign in page](/configuration/pages#credentials-sign-in) if you want to provide a custom user experience.
-
-
-
-export const Image = ({ children, src, alt = '' }) => (
-
-
-
-)
diff --git a/www/docs/providers/discord.md b/www/docs/providers/discord.md
deleted file mode 100644
index bd41d09591..0000000000
--- a/www/docs/providers/discord.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: discord
-title: Discord
----
-
-## Documentation
-
-https://discord.com/developers/docs/topics/oauth2
-
-## Configuration
-
-https://discord.com/developers/applications
-
-## Options
-
-The **Discord Provider** comes with a set of default options:
-
-- [Discord Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/discord.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Discord({
- clientId: process.env.DISCORD_CLIENT_ID,
- clientSecret: process.env.DISCORD_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/dropbox.md b/www/docs/providers/dropbox.md
deleted file mode 100644
index 5f06a0d2d4..0000000000
--- a/www/docs/providers/dropbox.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: dropbox
-title: Dropbox
----
-
-## Documentation
-
-https://developers.dropbox.com/oauth-guide
-
-## Configuration
-
-https://www.dropbox.com/developers/apps
-
-## Options
-
-The **Dropbox Provider** comes with a set of default options:
-
-- [Dropbox Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/dropbox.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Dropbox({
- clientId: process.env.DROPBOX_CLIENT_ID,
- clientSecret: process.env.DROPBOX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/email.md b/www/docs/providers/email.md
deleted file mode 100644
index 147260e80c..0000000000
--- a/www/docs/providers/email.md
+++ /dev/null
@@ -1,225 +0,0 @@
----
-id: email
-title: Email
----
-
-## Overview
-
-The Email provider uses email to send "magic links" that can be used to sign in, you will likely have seen these if you have used services like Slack before.
-
-Adding support for signing in via email in addition to one or more OAuth services provides a way for users to sign in if they lose access to their OAuth account (e.g. if it is locked or deleted).
-
-The Email provider can be used in conjunction with (or instead of) one or more OAuth providers.
-
-### How it works
-
-On initial sign in, a **Verification Token** is sent to the email address provided. By default this token is valid for 24 hours. If the Verification Token is used within that time (i.e. by clicking on the link in the email) an account is created for the user and they are signed in.
-
-If someone provides the email address of an _existing account_ when signing in, an email is sent and they are signed into the account associated with that email address when they follow the link in the email.
-
-:::tip
-The Email Provider can be used with both JSON Web Tokens and database sessions, but you **must** configure a database to use it. It is not possible to enable email sign in without using a database.
-:::
-
-## Options
-
-The **Email Provider** comes with a set of default options:
-
-- [Email Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/email.js)
-
-You can override any of the options to suit your own use case.
-
-## Configuration
-
-1. You will need an SMTP account; ideally for one of the [services known to work with `nodemailer`](http://nodemailer.com/smtp/well-known/).
-2. There are two ways to configure the SMTP server connection.
-
-You can either use a connection string or a `nodemailer` configuration object.
-
-2.1 **Using a connection string**
-
-Create an `.env` file to the root of your project and add the connection string and email address.
-
-```js title=".env" {1}
- EMAIL_SERVER=smtp://username:password@smtp.example.com:587
- EMAIL_FROM=noreply@example.com
-```
-
-Now you can add the email provider like this:
-
-```js {3} title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM
- }),
-],
-```
-
-2.2 **Using a configuration object**
-
-In your `.env` file in the root of your project simply add the configuration object options individually:
-
-```js title=".env"
-EMAIL_SERVER_USER=username
-EMAIL_SERVER_PASSWORD=password
-EMAIL_SERVER_HOST=smtp.example.com
- EMAIL_SERVER_PORT=587
- EMAIL_FROM=noreply@example.com
-```
-
-Now you can add the provider settings to the NextAuth options object in the Email Provider.
-
-```js title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: {
- host: process.env.EMAIL_SERVER_HOST,
- port: process.env.EMAIL_SERVER_PORT,
- auth: {
- user: process.env.EMAIL_SERVER_USER,
- pass: process.env.EMAIL_SERVER_PASSWORD
- }
- },
- from: process.env.EMAIL_FROM
- }),
-],
-```
-
-3. You can now sign in with an email address at `/api/auth/signin`.
-
-A user account (i.e. an entry in the Users table) will not be created for the user until the first time they verify their email address. If an email address is already associated with an account, the user will be signed in to that account when they use the link in the email.
-
-## Customizing emails
-
-You can fully customize the sign in email that is sent by passing a custom function as the `sendVerificationRequest` option to `Providers.Email()`.
-
-e.g.
-
-```js {3} title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- sendVerificationRequest: ({
- identifier: email,
- url,
- token,
- baseUrl,
- provider,
- }) => {
- /* your function */
- },
- }),
-]
-```
-
-The following code shows the complete source for the built-in `sendVerificationRequest()` method:
-
-```js
-import nodemailer from "nodemailer"
-
-const sendVerificationRequest = ({
- identifier: email,
- url,
- token,
- baseUrl,
- provider,
-}) => {
- return new Promise((resolve, reject) => {
- const { server, from } = provider
- // Strip protocol from URL and use domain as site name
- const site = baseUrl.replace(/^https?:\/\//, "")
-
- nodemailer.createTransport(server).sendMail(
- {
- to: email,
- from,
- subject: `Sign in to ${site}`,
- text: text({ url, site, email }),
- html: html({ url, site, email }),
- },
- (error) => {
- if (error) {
- logger.error("SEND_VERIFICATION_EMAIL_ERROR", email, error)
- return reject(new Error("SEND_VERIFICATION_EMAIL_ERROR", error))
- }
- return resolve()
- }
- )
- })
-}
-
-// Email HTML body
-const html = ({ url, site, email }) => {
- // Insert invisible space into domains and email address to prevent both the
- // email address and the domain from being turned into a hyperlink by email
- // clients like Outlook and Apple mail, as this is confusing because it seems
- // like they are supposed to click on their email address to sign in.
- const escapedEmail = `${email.replace(/\./g, ".")}`
- const escapedSite = `${site.replace(/\./g, ".")}`
-
- // Some simple styling options
- const backgroundColor = "#f9f9f9"
- const textColor = "#444444"
- const mainBackgroundColor = "#ffffff"
- const buttonBackgroundColor = "#346df1"
- const buttonBorderColor = "#346df1"
- const buttonTextColor = "#ffffff"
-
- // Uses tables for layout and inline CSS due to email client limitations
- return `
-
-
- If you did not request this email you can safely ignore it.
-
-
-
-
-`
-}
-
-// Email text body - fallback for email clients that don't render HTML
-const text = ({ url, site }) => `Sign in to ${site}\n${url}\n\n`
-```
-
-:::tip
-If you want to generate great looking email client compatible HTML with React, check out https://mjml.io
-:::
-
-## Customizing the Verification Token
-
-By default, we are generating a random verification token. You can define a `generateVerificationToken` method in your provider options if you want to override it:
-
-```js title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- async generateVerificationToken() {
- return "ABC123"
- }
- })
-],
-```
diff --git a/www/docs/providers/eveonline.md b/www/docs/providers/eveonline.md
deleted file mode 100644
index 7b02b0e878..0000000000
--- a/www/docs/providers/eveonline.md
+++ /dev/null
@@ -1,65 +0,0 @@
----
-id: eveonline
-title: EVE Online
----
-
-## Documentation
-
-https://developers.eveonline.com/blog/article/sso-to-authenticated-calls
-
-## Configuration
-
-https://developers.eveonline.com/
-
-## Options
-
-The **EVE Online Provider** comes with a set of default options:
-
-- [EVE Online Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/eveonline.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.EVEOnline({
- clientId: process.env.EVE_CLIENT_ID,
- clientSecret: process.env.EVE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip When creating your application, make sure to select `Authentication Only` as the connection type.
-
-:::tip If using JWT for the session, you can add the `CharacterID` to the JWT token and session. Example:
-
-```js
-...
-options: {
- jwt: {
- secret: process.env.JWT_SECRET,
- },
- callbacks: {
- jwt: async (token, user, account, profile, isNewUser) => {
- if (profile) {
- token = {
- ...token,
- id: profile.CharacterID,
- }
- }
- return token;
- },
- session: async (session, token) => {
- if (token) {
- session.user.id = token.id;
- }
- return session;
- }
- }
-}
-...
-```
diff --git a/www/docs/providers/facebook.md b/www/docs/providers/facebook.md
deleted file mode 100644
index c354b9247a..0000000000
--- a/www/docs/providers/facebook.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-id: facebook
-title: Facebook
----
-
-## Documentation
-
-https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/
-
-## Configuration
-
-https://developers.facebook.com/apps/
-
-## Options
-
-The **Facebook Provider** comes with a set of default options:
-
-- [Facebook Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/facebook.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Facebook({
- clientId: process.env.FACEBOOK_CLIENT_ID,
- clientSecret: process.env.FACEBOOK_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-Production applications cannot use localhost URLs to sign in with Facebook. You need to use a dedicated development application in Facebook to use **localhost** callback URLs.
-:::
-
-:::tip
-Email address may not be returned for accounts created on mobile.
-:::
diff --git a/www/docs/providers/faceit.md b/www/docs/providers/faceit.md
deleted file mode 100644
index 2a69d80517..0000000000
--- a/www/docs/providers/faceit.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: faceit
-title: FACEIT
----
-
-## Documentation
-
-https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf
-
-## Configuration
-
-https://developers.faceit.com/apps
-
-Grant type: `Authorization Code`
-
-Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile`
-
-## Options
-
-The **FACEIT Provider** comes with a set of default options:
-
-- [FACEIT Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/faceit.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FACEIT({
- clientId: process.env.FACEIT_CLIENT_ID,
- clientSecret: process.env.FACEIT_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/foursquare.md b/www/docs/providers/foursquare.md
deleted file mode 100644
index d8511b7e24..0000000000
--- a/www/docs/providers/foursquare.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-id: foursquare
-title: Foursquare
----
-
-## Documentation
-
-https://developer.foursquare.com/docs/places-api/authentication/#web-applications
-
-## Configuration
-
-https://developer.foursquare.com/
-
-:::warning
-Foursquare requires an additional `apiVersion` parameter in [`YYYYMMDD` format](https://developer.foursquare.com/docs/places-api/versioning/), which essentially states "I'm prepared for API changes up to this date".
-:::
-
-## Options
-
-The **Foursquare Provider** comes with a set of default options:
-
-- [Foursquare Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/foursquare.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Foursquare({
- clientId: process.env.FOURSQUARE_CLIENT_ID,
- clientSecret: process.env.FOURSQUARE_CLIENT_SECRET,
- apiVersion: 'YYYYMMDD'
- })
-]
-...
-```
diff --git a/www/docs/providers/freshbooks.md b/www/docs/providers/freshbooks.md
deleted file mode 100644
index 8e570a2609..0000000000
--- a/www/docs/providers/freshbooks.md
+++ /dev/null
@@ -1,33 +0,0 @@
----
-id: freshbooks
-title: Freshbooks
----
-
-## Documentation
-
-https://www.freshbooks.com/api/authenticating-with-oauth-2-0-on-the-new-freshbooks-api
-
-## Configuration
-
-https://my.freshbooks.com/#/developer
-
-## Options
-
-The Freshbooks Provider comes with a set of default options:
-
-https://www.freshbooks.com/api/start
-
-You can override any of the options to suit your own use case.
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Freshbooks({
- clientId: process.env.FRESHBOOKS_CLIENT_ID,
- clientSecret: process.env.FRESHBOOKS_CLIENT_SECRET,
- })
-]
-...
-```
diff --git a/www/docs/providers/fusionauth.md b/www/docs/providers/fusionauth.md
deleted file mode 100644
index 4c375e4e22..0000000000
--- a/www/docs/providers/fusionauth.md
+++ /dev/null
@@ -1,55 +0,0 @@
----
-id: fusionauth
-title: FusionAuth
----
-
-## Documentation
-
-https://fusionauth.io/docs/v1/tech/oauth/
-
-## Options
-
-The **FusionAuth Provider** comes with a set of default options:
-
-- [FusionAuth Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/fusionauth.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FusionAuth({
- id: "fusionauth",
- name: "FusionAuth",
- domain: process.env.FUSIONAUTH_DOMAIN,
- clientId: process.env.FUSIONAUTH_CLIENT_ID,
- clientSecret: process.env.FUSIONAUTH_SECRET,
- tenantId: process.env.FUSIONAUTH_TENANT_ID // Only required if you're using multi-tenancy
- }),
-]
-...
-```
-
-:::warning
-If you're using multi-tenancy, you need to pass in the `tenantId` option to apply the proper theme.
-:::
-
-## Instructions
-
-### Configuration
-
-:::tip
-An application can be created at https://your-fusionauth-server-url/admin/application.
-
-For more information, follow the [FusionAuth 5-minute setup guide](https://fusionauth.io/docs/v1/tech/5-minute-setup-guide).
-:::
-
-In the OAuth settings for your application, configure the following.
-
-- Redirect URL
- - https://localhost:3000/api/auth/callback/fusionauth
-- Enabled grants
- - Make sure _Authorization Code_ is enabled.
diff --git a/www/docs/providers/github.md b/www/docs/providers/github.md
deleted file mode 100644
index b11693cfcb..0000000000
--- a/www/docs/providers/github.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-id: github
-title: GitHub
----
-
-## Documentation
-
-https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps
-
-## Configuration
-
-https://github.com/settings/apps
-
-## Options
-
-The **Github Provider** comes with a set of default options:
-
-- [Github Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/github.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_CLIENT_ID,
- clientSecret: process.env.GITHUB_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Only allows one callback URL per Client ID / Client Secret.
-:::
-
-:::tip
-Email address is not returned if privacy settings are enabled.
-:::
diff --git a/www/docs/providers/gitlab.md b/www/docs/providers/gitlab.md
deleted file mode 100644
index 3455a42320..0000000000
--- a/www/docs/providers/gitlab.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: gitlab
-title: GitLab
----
-
-## Documentation
-
-https://docs.gitlab.com/ee/api/oauth2.html
-
-## Configuration
-
-https://gitlab.com/profile/applications
-
-## Options
-
-The **Gitlab Provider** comes with a set of default options:
-
-- [Gitlab Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/gitlab.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.GitLab({
- clientId: process.env.GITLAB_CLIENT_ID,
- clientSecret: process.env.GITLAB_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-Enable the _"read_user"_ option in scope if you want to save the users email address on sign up.
-:::
diff --git a/www/docs/providers/google.md b/www/docs/providers/google.md
deleted file mode 100644
index 721d727571..0000000000
--- a/www/docs/providers/google.md
+++ /dev/null
@@ -1,85 +0,0 @@
----
-id: google
-title: Google
----
-
-## Documentation
-
-https://developers.google.com/identity/protocols/oauth2
-
-## Configuration
-
-https://console.developers.google.com/apis/credentials
-
-## Options
-
-The **Google Provider** comes with a set of default options:
-
-- [Google Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/google.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Google only provides Refresh Token to an application the first time a user signs in.
-
-To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again:
-https://myaccount.google.com/permissions
-
-Alternatively, you can also pass options in the `authorizationUrl` which will force the Refresh Token to always be provided on sign in, however this will ask all users to confirm if they wish to grant your application access every time they sign in.
-
-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
-const options = {
- ...
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&response_type=code',
- })
- ],
- ...
-}
-```
-
-:::
-
-:::tip
-Google also returns a `verified_email` boolean property in the OAuth profile.
-
-You can use this property to restrict access to people with verified accounts at a particular domain.
-
-```js
-const options = {
- ...
- callbacks: {
- async signIn(user, account, profile) {
- if (account.provider === 'google' &&
- profile.verified_email === true &&
- profile.email.endsWith('@example.com')) {
- return true
- } else {
- return false
- }
- },
- }
- ...
-}
-```
-
-:::
diff --git a/www/docs/providers/identity-server4.md b/www/docs/providers/identity-server4.md
deleted file mode 100644
index b0811554df..0000000000
--- a/www/docs/providers/identity-server4.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-id: identity-server4
-title: IdentityServer4
----
-
-## Documentation
-
-https://identityserver4.readthedocs.io/en/latest/
-
-## Options
-
-The **IdentityServer4 Provider** comes with a set of default options:
-
-- [IdentityServer4 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/identity-server4.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.IdentityServer4({
- id: "identity-server4",
- name: "IdentityServer4",
- scope: "openid profile email api offline_access", // Allowed Scopes
- domain: process.env.IdentityServer4_Domain,
- clientId: process.env.IdentityServer4_CLIENT_ID,
- clientSecret: process.env.IdentityServer4_CLIENT_SECRET
- })
-]
-...
-```
-
-## Demo IdentityServer
-
-The configuration below is for the demo server at https://demo.identityserver.io/
-
-If you want to try it out, you can copy and paste the configuration below.
-
-You can sign in to the demo service with either bob/bob or alice/alice.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.IdentityServer4({
- id: "demo-identity-server",
- name: "Demo IdentityServer4",
- scope: "openid profile email api offline_access",
- domain: "demo.identityserver.io",
- clientId: "interactive.confidential",
- clientSecret: "secret",
- checks: ["pkce"]
- })
-}
-...
-```
diff --git a/www/docs/providers/instagram.md b/www/docs/providers/instagram.md
deleted file mode 100644
index a164e58653..0000000000
--- a/www/docs/providers/instagram.md
+++ /dev/null
@@ -1,50 +0,0 @@
----
-id: instagram
-title: Instagram
----
-
-## Documentation
-
-https://developers.facebook.com/docs/instagram-basic-display-api/getting-started
-
-## Configuration
-
-https://developers.facebook.com/apps/
-
-## Options
-
-The **Instagram Provider** comes with a set of default options:
-
-- [Instagram Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/instagram.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```jsx
-// pages/api/auth/[...nextauth].js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Instagram({
- clientId: process.env.INSTAGRAM_CLIENT_ID,
- clientSecret: process.env.INSTAGRAM_CLIENT_SECRET
- })
-]
-...
-// pages/index.jsx
-import { signIn } from "next-auth/react"
-...
-
-...
-```
-
-:::warning
-Email address is not returned by the Instagram API.
-:::
-
-:::tip
-Instagram display app required callback URL to be configured in your Facebook app and Facebook required you to use **https** even for localhost! In order to do that, you either need to [add an SSL to your localhost](https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/) or use a proxy such as [ngrok](https://ngrok.com/docs).
-:::
diff --git a/www/docs/providers/kakao.md b/www/docs/providers/kakao.md
deleted file mode 100644
index 8b40b7e374..0000000000
--- a/www/docs/providers/kakao.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-id: kakao
-title: Kakao
----
-
-## Documentation
-
-https://developers.kakao.com/product/kakaoLogin
-
-## Configuration
-
-https://developers.kakao.com/docs/latest/en/kakaologin/common
-
-## Options
-
-The **Kakao Provider** comes with a set of default options:
-
-- [Kakao Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/kakao.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Kakao({
- clientId: process.env.KAKAO_CLIENT_ID,
- clientSecret: process.env.KAKAO_CLIENT_SECRET
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-Create a provider and a Kakao application at `https://developers.kakao.com/console/app`. In the settings of the app under Kakao Login, activate web app, change consent items and configure callback URL.
diff --git a/www/docs/providers/keycloak.md b/www/docs/providers/keycloak.md
deleted file mode 100644
index 47424d13e0..0000000000
--- a/www/docs/providers/keycloak.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-id: keycloak
-title: Keycloak
----
-
-## Documentation
-
-https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients
-
-## Configuration
-
-:::tip
-Create an openid-connect client in Keycloak with "confidential" as the "Access Type".
-:::
-
-## Options
-
-The **Keycloak Provider** comes with a set of default options:
-
-- [Keycloak Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/keycloak.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Keycloak({
- clientId: process.env.KEYCLOAK_ID,
- clientSecret: process.env.KEYCLOAK_SECRET,
- issuer: process.env.KEYCLOAK_ISSUER,
- })
-]
-...
-```
-
-:::note
-`issuer` should include the realm – e.g. `https://my-keycloak-domain.com/auth/realms/My_Realm`
-:::
diff --git a/www/docs/providers/line.md b/www/docs/providers/line.md
deleted file mode 100644
index 6c659a4882..0000000000
--- a/www/docs/providers/line.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: line
-title: LINE
----
-
-## Documentation
-
-https://developers.line.biz/en/docs/line-login/integrate-line-login/
-
-## Configuration
-
-https://developers.line.biz/console/
-
-## Options
-
-The **Line Provider** comes with a set of default options:
-
-- [Line Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/line.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.LINE({
- clientId: process.env.LINE_CLIENT_ID,
- clientSecret: process.env.LINE_CLIENT_SECRET
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-Create a provider and a LINE login channel at `https://developers.line.biz/console/`. In the settings of the channel under LINE Login, activate web app and configure the following:
-
-- Callback URL
- - http://localhost:3000/api/auth/callback/line
diff --git a/www/docs/providers/linkedin.md b/www/docs/providers/linkedin.md
deleted file mode 100644
index 6d91bacfc3..0000000000
--- a/www/docs/providers/linkedin.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: linkedin
-title: LinkedIn
----
-
-## Documentation
-
-https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow
-
-## Configuration
-
-https://www.linkedin.com/developers/apps/
-
-From the Auth tab get the client ID and client secret. On the same tab, add redirect URLs such as http://localhost:3000/api/auth/callback/linkedin so LinkedIn can correctly redirect back to your application. Finally, head over to the Products tab and enable the "Sign In with LinkedIn" product. The LinkedIn team will review and approve your request before you can test it out.
-
-![image](https://user-images.githubusercontent.com/330396/114429603-68195600-9b72-11eb-8311-62e58383c42b.png)
-
-## Options
-
-The **LinkedIn Provider** comes with a set of default options:
-
-- [LinkedIn Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/linkedin.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.LinkedIn({
- clientId: process.env.LINKEDIN_CLIENT_ID,
- clientSecret: process.env.LINKEDIN_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/mailchimp.md b/www/docs/providers/mailchimp.md
deleted file mode 100644
index ab600cf861..0000000000
--- a/www/docs/providers/mailchimp.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: mailchimp
-title: Mailchimp
----
-
-## Documentation
-
-https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/
-
-## Configuration
-
-https://admin.mailchimp.com/account/oauth2/client/
-
-## Options
-
-The **Mailchimp Provider** comes with a set of default options:
-
-- [Mailchimp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailchimp.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Mailchimp({
- clientId: process.env.MAILCHIMP_CLIENT_ID,
- clientSecret: process.env.MAILCHIMP_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/mailru.md b/www/docs/providers/mailru.md
deleted file mode 100644
index 530ccfcbd2..0000000000
--- a/www/docs/providers/mailru.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: mailru
-title: Mail.ru
----
-
-## Documentation
-
-https://o2.mail.ru/docs
-
-## Configuration
-
-https://o2.mail.ru/app/
-
-## Options
-
-The **Mail.ru Provider** comes with a set of default options:
-
-- [Mail.ru Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailru.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.MailRu({
- clientId: process.env.MAILRU_CLIENT_ID,
- clientSecret: process.env.MAILRU_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/medium.md b/www/docs/providers/medium.md
deleted file mode 100644
index 751e5a2b43..0000000000
--- a/www/docs/providers/medium.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: medium
-title: Medium
----
-
-## Documentation
-
-https://github.com/Medium/medium-api-docs
-
-## Configuration
-
-https://medium.com/me/applications
-
-## Options
-
-The **Medium Provider** comes with a set of default options:
-
-- [Medium Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/medium.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Medium({
- clientId: process.env.MEDIUM_CLIENT_ID,
- clientSecret: process.env.MEDIUM_CLIENT_SECRET
- })
-}
-...
-```
-
-:::warning
-Email address is not returned by the Medium API.
-:::
diff --git a/www/docs/providers/naver.md b/www/docs/providers/naver.md
deleted file mode 100644
index eb27c4623d..0000000000
--- a/www/docs/providers/naver.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: naver
-title: Naver
----
-
-## Documentation
-
-https://developers.naver.com/docs/login/overview/overview.md
-
-## Configuration
-
-https://developers.naver.com/docs/login/api/api.md
-
-## Options
-
-The **Naver Provider** comes with a set of default options:
-
-- [Naver Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/naver.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Naver({
- clientId: process.env.NAVER_CLIENT_ID,
- clientSecret: process.env.NAVER_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/netlify.md b/www/docs/providers/netlify.md
deleted file mode 100644
index b9c4c07bb8..0000000000
--- a/www/docs/providers/netlify.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: netlify
-title: Netlify
----
-
-## Documentation
-
-https://www.netlify.com/blog/2016/10/10/integrating-with-netlify-oauth2/
-
-## Configuration
-
-https://github.com/netlify/netlify-oauth-example
-
-## Options
-
-The **Netlify Provider** comes with a set of default options:
-
-- [Netlify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/netlify.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Netlify({
- clientId: process.env.NETLIFY_CLIENT_ID,
- clientSecret: process.env.NETLIFY_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/okta.md b/www/docs/providers/okta.md
deleted file mode 100644
index ea4dc7a7bc..0000000000
--- a/www/docs/providers/okta.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-id: okta
-title: Okta
----
-
-## Documentation
-
-https://developer.okta.com/docs/reference/api/oidc
-
-## Options
-
-The **Okta Provider** comes with a set of default options:
-
-- [Okta Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/okta.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Okta({
- clientId: process.env.OKTA_CLIENT_ID,
- clientSecret: process.env.OKTA_CLIENT_SECRET,
- domain: process.env.OKTA_DOMAIN
- })
-]
-...
-```
diff --git a/www/docs/providers/onelogin.md b/www/docs/providers/onelogin.md
deleted file mode 100644
index b4abfc35f2..0000000000
--- a/www/docs/providers/onelogin.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-id: onelogin
-title: OneLogin
----
-
-## Documentation
-
-https://developers.onelogin.com/openid-connect
-
-## Configuration
-
-https://developers.onelogin.com/openid-connect/connect-to-onelogin
-
-## Options
-
-The **OneLogin Provider** comes with a set of default options:
-
-- [OneLogin Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/onelogin.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.OneLogin({
- clientId: process.env.ONELOGIN_CLIENT_ID,
- clientSecret: process.env.ONELOGIN_CLIENT_SECRET,
- domain: process.env.ONELOGIN_DOMAIN
- })
-]
-...
-```
diff --git a/www/docs/providers/osso.md b/www/docs/providers/osso.md
deleted file mode 100644
index 332d157487..0000000000
--- a/www/docs/providers/osso.md
+++ /dev/null
@@ -1,47 +0,0 @@
----
-id: osso
-title: Osso
----
-
-## Documentation
-
-Osso is an open source service that handles SAML authentication against Identity Providers, normalizes profiles, and makes those profiles available to you in an OAuth 2.0 code grant flow.
-
-If you don't yet have an Osso instance, you can use [Osso's Demo App](https://demo.ossoapp.com) for your testing purposes. For documentation on deploying an Osso instance, see https://ossoapp.com/docs/deploy/overview/
-
-## Configuration
-
-You can configure your OAuth Clients on your Osso Admin UI, i.e. https://demo.ossoapp.com/admin/config - you'll need to get a Client ID and Secret and allow-list your redirect URIs.
-
-[SAML SSO differs a bit from OAuth](https://ossoapp.com/blog/saml-vs-oauth) - for every tenant who wants to sign in to your application using SAML, you and your customer need to perform a multi-step configuration in Osso's Admin UI and the admin dashboard of the tenant's Identity Provider. Osso provides documentation for providers like Okta and OneLogin, cloud-based IDPs who also offer a developer account that's useful for testing. Osso also provides a [Mock IDP](https://idp.ossoapp.com) that you can use for testing without needing to sign up for an Identity Provider service.
-
-See Osso's complete configuration and testing documentation at https://ossoapp.com/docs/configure/overview
-
-## Options
-
-The **Osso Provider** comes with a set of default options:
-
-- [Osso Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/osso.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-A full example application is available at https://github.com/enterprise-oss/osso-next-auth-example and https://nextjs-demo.ossoapp.com
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Osso({
- clientId: process.env.OSSO_CLIENT_ID,
- clientSecret: process.env.OSSO_CLIENT_SECRET,
- domain: process.env.OSSO_DOMAIN
- })
-}
-...
-```
-
-:::note
-`domain` should be the fully qualified domain – e.g. `demo.ossoapp.com`
-:::
diff --git a/www/docs/providers/reddit.md b/www/docs/providers/reddit.md
deleted file mode 100644
index dad51fc5a8..0000000000
--- a/www/docs/providers/reddit.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-id: reddit
-title: Reddit
----
-
-## Documentation
-
-https://www.reddit.com/dev/api/
-
-## Configuration
-
-https://www.reddit.com/prefs/apps/
-
-## Options
-
-The **Reddit Provider** comes with a set of default options:
-
-- [Reddit Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/reddit.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Reddit({
- clientId: process.env.REDDIT_CLIENT_ID,
- clientSecret: process.env.REDDIT_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Reddit requires authorization every time you go through their page.
-:::
-
-:::warning
-Only allows one callback URL per Client ID / Client Secret.
-:::
-
-:::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
-providers: [
- {
- id: "reddit",
- name: "Reddit",
- clientId: process.env.REDDIT_CLIENT_ID,
- clientSecret: process.env.REDDIT_CLIENT_SECRET,
- scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required.
- type: "oauth",
- version: "2.0",
- params: { grant_type: "authorization_code" },
- accessTokenUrl: " https://www.reddit.com/api/v1/access_token",
- authorizationUrl:
- "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent",
- profileUrl: "https://oauth.reddit.com/api/v1/me",
- profile: (profile) => {
- return {
- id: profile.id,
- name: profile.name,
- email: null,
- }
- },
- },
-]
-```
-
-:::
diff --git a/www/docs/providers/salesforce.md b/www/docs/providers/salesforce.md
deleted file mode 100644
index 2a55b7f5f3..0000000000
--- a/www/docs/providers/salesforce.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-id: salesforce
-title: Salesforce
----
-
-## Documentation
-
-https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&type=5
-
-## Options
-
-The **Salesforce Provider** comes with a set of default options:
-
-- [Salesforce Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/salesforce.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Salesforce({
- clientId: process.env.SALESFORCE_CLIENT_ID,
- clientSecret: process.env.SALESFORCE_CLIENT_SECRET,
- })
-]
-...
-```
diff --git a/www/docs/providers/slack.md b/www/docs/providers/slack.md
deleted file mode 100644
index 64e295d203..0000000000
--- a/www/docs/providers/slack.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-id: slack
-title: Slack
----
-
-## Documentation
-
-https://api.slack.com/authentication
-https://api.slack.com/docs/sign-in-with-slack
-
-## Configuration
-
-https://api.slack.com/apps
-
-## Options
-
-The **Slack Provider** comes with a set of default options:
-
-- [Slack Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/slack.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Slack({
- clientId: process.env.SLACK_CLIENT_ID,
- clientSecret: process.env.SLACK_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/spotify.md b/www/docs/providers/spotify.md
deleted file mode 100644
index 695642fb54..0000000000
--- a/www/docs/providers/spotify.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: spotify
-title: Spotify
----
-
-## Documentation
-
-https://developer.spotify.com/documentation
-
-## Configuration
-
-https://developer.spotify.com/dashboard/applications
-
-## Options
-
-The **Spotify Provider** comes with a set of default options:
-
-- [Spotify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/spotify.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Spotify({
- clientId: process.env.SPOTIFY_CLIENT_ID,
- clientSecret: process.env.SPOTIFY_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/strava.md b/www/docs/providers/strava.md
deleted file mode 100644
index 3df758a90b..0000000000
--- a/www/docs/providers/strava.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-id: strava
-title: Strava
----
-
-## Documentation
-
-http://developers.strava.com/docs/reference/
-
-## Options
-
-The **Strava Provider** comes with a set of default options:
-
-- [Strava Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/strava.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from 'next-auth/providers'
-...
-providers: [
- Providers.Strava({
- clientId: process.env.STRAVA_CLIENT_ID,
- clientSecret: process.env.STRAVA_CLIENT_SECRET,
- })
-]
-...
-```
diff --git a/www/docs/providers/twitch.md b/www/docs/providers/twitch.md
deleted file mode 100644
index d0405e1766..0000000000
--- a/www/docs/providers/twitch.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-id: twitch
-title: Twitch
----
-
-## Documentation
-
-https://dev.twitch.tv/docs/authentication
-
-## Configuration
-
-https://dev.twitch.tv/console/apps
-
-Add the following redirect URL into the console `http:///api/auth/callback/twitch`
-
-## Options
-
-The **Twitch Provider** comes with a set of default options:
-
-- [Twitch Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitch.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitch({
- clientId: process.env.TWITCH_CLIENT_ID,
- clientSecret: process.env.TWITCH_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/twitter.md b/www/docs/providers/twitter.md
deleted file mode 100644
index 7296a1ffde..0000000000
--- a/www/docs/providers/twitter.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-id: twitter
-title: Twitter
----
-
-## Documentation
-
-https://developer.twitter.com
-
-## Configuration
-
-https://developer.twitter.com/en/apps
-
-## Options
-
-The **Twitter Provider** comes with a set of default options:
-
-- [Twitter Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitter.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_CLIENT_ID,
- clientSecret: process.env.TWITTER_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-You must enable the _"Request email address from users"_ option in your app permissions if you want to obtain the users email address.
-:::
-
-![twitter](https://user-images.githubusercontent.com/7902980/83944068-1640ca80-a801-11ea-959c-0e744e2144f7.PNG)
diff --git a/www/docs/providers/vk.md b/www/docs/providers/vk.md
deleted file mode 100644
index 83d1e6ce3a..0000000000
--- a/www/docs/providers/vk.md
+++ /dev/null
@@ -1,57 +0,0 @@
----
-id: vk
-title: VK
----
-
-## Documentation
-
-https://vk.com/dev/first_guide
-
-## Configuration
-
-https://vk.com/apps?act=manage
-
-## Options
-
-The **VK Provider** comes with a set of default options:
-
-- [VK Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/vk.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.VK({
- clientId: process.env.VK_CLIENT_ID,
- clientSecret: process.env.VK_CLIENT_SECRET
- })
-]
-...
-```
-
-:::note
-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
-// pages/api/auth/[...nextauth].js
-
-const apiVersion = "5.126"
-...
-providers: [
- Providers.VK({
- accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
- requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
- authorizationUrl:
- `https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`,
- profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`,
- })
-]
-...
-```
diff --git a/www/docs/providers/wordpress.md b/www/docs/providers/wordpress.md
deleted file mode 100644
index 2ace7ef885..0000000000
--- a/www/docs/providers/wordpress.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: wordpress
-title: WordPress.com
----
-
-## Documentation
-
-https://developer.wordpress.com/docs/oauth2/
-
-## Configuration
-
-https://developer.wordpress.com/apps/
-
-## Options
-
-The **Wordpress Provider** comes with a set of default options:
-
-- [Wordpress Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/wordpress.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.WordPress({
- clientId: process.env.WORDPRESS_CLIENT_ID,
- clientSecret: process.env.WORDPRESS_CLIENT_SECRET
- })
-}
-...
-```
-
-:::tip
-Register your application to obtain Client ID and Client Secret at https://developer.wordpress.com/apps/ Select Type as Web and set Redirect URL to `http://example.com/api/auth/callback/wordpress` where example.com is your site domain.
-:::
diff --git a/www/docs/providers/workos.md b/www/docs/providers/workos.md
deleted file mode 100644
index 07bd59c062..0000000000
--- a/www/docs/providers/workos.md
+++ /dev/null
@@ -1,113 +0,0 @@
----
-id: workos
-title: WorkOS
----
-
-## Documentation
-
-https://workos.com/docs/sso/guide
-
-## Configuration
-
-https://dashboard.workos.com
-
-## Options
-
-The **WorkOS Provider** comes with a set of default options:
-
-- [WorkOS Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/workos.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.WorkOS({
- clientId: process.env.WORKOS_CLIENT_ID,
- clientSecret: process.env.WORKOS_API_KEY,
- }),
-],
-...
-```
-
-WorkOS is not an identity provider itself, but, rather, a bridge to multiple single sign-on (SSO) providers. As a result, we need to make some additional changes to authenticate users using WorkOS.
-
-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:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-...
- pages: {
- signIn: '/auth/signin',
- }
-```
-
-We can then add a custom login page that displays an input where the user can enter their email address. We then extract the domain from the user's email address and pass it to the `authorizationParams` parameter on the `signIn` function:
-
-```jsx title="pages/auth/signin.js"
-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 (
-
-
-
- )
- })}
- >
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const providers = await getProviders()
- return {
- props: { providers },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async () => {
- return {
- providers: await getProviders()
- }
-}
-*/
-```
diff --git a/www/docs/providers/yandex.md b/www/docs/providers/yandex.md
deleted file mode 100644
index f0fb48bbf6..0000000000
--- a/www/docs/providers/yandex.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: yandex
-title: Yandex
----
-
-## Documentation
-
-https://tech.yandex.com/oauth/doc/dg/concepts/about-docpage/
-
-## Configuration
-
-https://oauth.yandex.com/client/new
-
-## Options
-
-The **Yandex Provider** comes with a set of default options:
-
-- [Yandex Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/yandex.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Yandex({
- clientId: process.env.YANDEX_CLIENT_ID,
- clientSecret: process.env.YANDEX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/zoho.md b/www/docs/providers/zoho.md
deleted file mode 100644
index 739d882b1d..0000000000
--- a/www/docs/providers/zoho.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: zoho
-title: Zoho
----
-
-## Documentation
-
-https://www.zoho.com/accounts/protocol/oauth/web-server-applications.html
-
-## Configuration
-
-https://api-console.zoho.com/
-
-## Options
-
-The **Zoho Provider** comes with a set of default options:
-
-- [Zoho Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoho.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Zoho({
- clientId: process.env.ZOHO_CLIENT_ID,
- clientSecret: process.env.ZOHO_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/docs/providers/zoom.md b/www/docs/providers/zoom.md
deleted file mode 100644
index 2c6c0969ce..0000000000
--- a/www/docs/providers/zoom.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: zoom
-title: Zoom
----
-
-## Documentation
-
-https://marketplace.zoom.us/docs/guides/auth/oauth
-
-## Configuration
-
-https://marketplace.zoom.us
-
-## Options
-
-The **Zoom Provider** comes with a set of default options:
-
-- [Zoom Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoom.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Zoom({
- clientId: process.env.ZOOM_CLIENT_ID,
- clientSecret: process.env.ZOOM_CLIENT_SECRET
- })
-}
-...
-```
diff --git a/www/docs/tutorials.md b/www/docs/tutorials.md
deleted file mode 100644
index 3804d760c9..0000000000
--- a/www/docs/tutorials.md
+++ /dev/null
@@ -1,102 +0,0 @@
----
-id: tutorials
-title: Tutorials and Explainers
----
-
-> These tutorials are contributed by the community. Unless otherwise indicated, tutorials are hosted on this site. External and video based tutorials are denoted with the appropriate icons.
->
-> **New submissions and edits are welcome!**
-
-## Basics
-
-#### [Introduction to NextAuth.js](https://www.youtube.com/watch?v=npZsJxWntJM)
-
-- This is an introductory video to NextAuth.js for beginners. In this video, it is explained how to set up authentication in a few easy steps and add different configurations to make it more robust and secure.
-
-#### [Authentication patterns for Next.js](https://leerob.io/blog/nextjs-authentication)
-
-- Next.js supports multiple patterns for authentication, each designed for different use cases. This guide will allow you to choose your adventure based on your constraints. By Lee Robinson.
-
-#### [Adding Authentication to an existing Next.js Application in no time!](https://dev.to/ndom91/adding-authentication-to-an-existing-serverless-next-js-app-in-no-time-with-nextauth-js-192h)
-
-- This tutorial walks one through adding NextAuth.js to an existing project. Including setting up the OAuth client id and secret, adding the API routes for authentication, protecting pages and API routes behind that authentication, etc.
-
-#### [Securing pages and API routes](tutorials/securing-pages-and-api-routes)
-
-- How to restrict access to pages and API routes.
-
-#### [Usage with class components](tutorials/usage-with-class-components)
-
-- How to use `useSession()` hook with class components.
-
-#### [Adding social authentication support to a Next.js app](https://getstarted.sh/bulletproof-next/add-social-authentication)
-
-- A tutorial by Arunoda Susirpiala. Checkout [GetStarted](https://getstarted.sh/) for more examples.
-
-#### [How to Authenticate Next.js Apps with Twitter & NextAuth.js](https://spacejelly.dev/posts/how-to-authenticate-next-js-apps-with-twitter-nextauth-js/)
-
-- Learn how to add Twitter authentication and login to a Next.js app both clientside and serverside with NextAuth.js.
-
-#### [NextJS Authentication Crash Course with NextAuth.js](https://youtu.be/o_wZIVmWteQ)
-
-- This tutorial dives into the ins and outs of NextAuth, including using the Email, Github, Twitter and Auth0 providers in under an hour.
-
-#### [Create your own NextAuth.js Login Pages](https://youtu.be/kB6YNYZ63fw)
-
-- This tutorial shows you how to jump in and create your own custom login pages versus using the ones provided by NextAuth.js
-
-#### [Passwordless Authentication with next-auth](https://www.youtube.com/watch?v=GPBD3acOx_M)
-
-- A video tutorial by Xiaoru Li from Prisma.
-
-## Fullstack
-
-#### [Passwordless Authentication with Next.js, Prisma, and next-auth](https://dev.to/prisma/passwordless-authentication-with-next-js-prisma-and-next-auth-5g8g)
-
-- In this post, you'll learn how to add passwordless authentication to your Next.js app using Prisma and next-auth. By the end of this tutorial, your users will be able to log in to your app with either their GitHub account or a Slack-styled magic link sent right to their Email inbox. By Xiaoru Li.
-
-#### [Fullstack Authentication Example with Next.js and NextAuth.js](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes-auth)
-
-- This example shows how to implement a full-stack app in TypeScript with Next.js using Prisma Client as a backend. It also demonstrates how to implement authentication using NextAuth.js. By Nikolas Burk at Prisma.
-
-## Testing
-
-#### [Testing with Cypress](tutorials/testing-with-cypress)
-
-- How to write tests using Cypress.
-
-## Advanced
-
-#### [Refresh Token Rotation](tutorials/refresh-token-rotation)
-
-- How to implement refresh token rotation.
-
-#### [LDAP Authentication](tutorials/ldap-auth-example)
-
-- How to use the Credentials Provider to authenticate against an LDAP database. This approach can be used to authenticate existing user accounts against any backend.
-
-#### [Add auth support to a Next.js app with a custom backend](https://arunoda.me/blog/add-auth-support-to-a-next-js-app-with-a-custom-backend)
-
-- A tutorial by Arunoda Susirpiala.
-
-#### [How to Configure Azure AD B2C Authentication with Next.js](https://benjaminwfox.com/blog/tech/how-to-configure-azure-b2c-with-nextjs)
-
-- Configuring authentication with Azure B2C in Next.js is not a particularly straight forward process. We'll look at how to facilitate this using the NextAuth.js library. By Ben Fox.
-
-#### [Sign in with Apple in NextJS](https://thesiddd.com/blog/apple-auth)
-
-- This tutorial walks step by step on how to get sign in with Apple working (both locally and on a deployed website) using NextAuth.js.
-
-## Database
-
-#### [Custom models with TypeORM](tutorials/typeorm-custom-models)
-
-- How to use models with custom properties using the TypeORM adapter.
-
-#### [Creating a database adapter](tutorials/creating-a-database-adapter)
-
-- How to create a custom adapter, to use any database to fetch and store user / account data.
-
-### [Using NextAuth.js with Magic links](https://dev.to/narciero/using-nextauth-js-with-magic-links-df4)
-
-Learn how to use [Magic](https://magic.link) link authentication with [NextAuth.js](https://next-auth.js.org) to enable passwordless authentication without a database.
diff --git a/www/docs/tutorials/creating-a-database-adapter.md b/www/docs/tutorials/creating-a-database-adapter.md
deleted file mode 100644
index 0a5371e36e..0000000000
--- a/www/docs/tutorials/creating-a-database-adapter.md
+++ /dev/null
@@ -1,91 +0,0 @@
----
-id: creating-a-database-adapter
-title: Create an adapter
----
-
-Using a custom adapter you can connect to any database back-end or even several different databases. Official adapters created and maintained by our community can be found in the [adapters repository](https://github.com/nextauthjs/adapters). Feel free to add a custom adapter from your project to the repository, or even become a maintainer of a certain adapter. Custom adapters can still be created and used in a project without being added to the repository.
-
-## How to create an adapter
-
-_See the code below for practical example._
-
-### Example code
-
-```ts
-/** @return { import("next-auth/adapters").Adapter } */
-export default function MyAdapter(client, options = {}) {
- return {
- async createUser(user) {
- return
- },
- async getUser(id) {
- return
- },
- async getUserByEmail(email) {
- return
- },
- async getUserByAccount({ provider, id }) {
- return
- },
- async updateUser(user) {
- return
- },
- async deleteUser(userId) {
- return
- },
- async linkAccount(account) {
- return
- },
- async unlinkAccount({ provider, id }) {
- return
- },
- async createSession({ sessionToken, userId, expires }) {
- return
- },
- async getSessionAndUser(sessionToken) {
- return
- },
- async updateSession({ sessionToken }) {
- return
- },
- async deleteSession(sessionToken) {
- return
- },
- async createVerificationToken({ identifier, expires, token }) {
- return
- },
- async useVerificationToken({ identifier, token }) {
- return
- },
- }
-}
-```
-
-
-### Required methods
-
-These methods are required for all sign in flows:
-
-* `createUser`
-* `getUser`
-* `getUserByEmail`
-* `getUserByAccount`
-* `linkAccount`
-* `createSession`
-* `getSessionAndUser`
-* `updateSession`
-* `deleteSession`
-* `updateUser`
-
-These methods are required to support email / passwordless sign in:
-
-* `createVerificationToken`
-* `useVerificationToken`
-
-### Unimplemented methods
-
-These methods will be required in a future release, but are not yet invoked:
-
-* `deleteUser`
-* `unlinkAccount`
-
diff --git a/www/docs/tutorials/ldap-auth.md b/www/docs/tutorials/ldap-auth.md
deleted file mode 100644
index 4323a3925c..0000000000
--- a/www/docs/tutorials/ldap-auth.md
+++ /dev/null
@@ -1,82 +0,0 @@
----
-id: ldap-auth-example
-title: LDAP Authentication
----
-
-NextAuth.js provides the ability to setup a [custom Credential provider](/configuration/providers#sign-in-with-credentials) which we can take advantage of to authenticate users against an existing LDAP server.
-
-You will need an additional dependency, `ldapjs`, which you can install by running `npm install ldapjs`.
-
-Then you must setup the `Providers.Credentials()` provider key like so:
-
-```js title="[...nextauth].js"
-const ldap = require("ldapjs")
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-export default NextAuth({
- providers: [
- Providers.Credentials({
- name: "LDAP",
- credentials: {
- username: { label: "DN", type: "text", placeholder: "" },
- password: { label: "Password", type: "password" },
- },
- async authorize(credentials, req) {
- // You might want to pull this call out so we're not making a new LDAP client on every login attemp
- const client = ldap.createClient({
- url: process.env.LDAP_URI,
- })
-
- // Essentially promisify the LDAPJS client.bind function
- return new Promise((resolve, reject) => {
- client.bind(credentials.username, credentials.password, (error) => {
- if (error) {
- console.error("Failed")
- reject()
- } else {
- console.log("Logged in")
- resolve({
- username: credentials.username,
- password: credentials.password,
- })
- }
- })
- })
- },
- }),
- ],
- callbacks: {
- async jwt({ token, user }) {
- const isSignIn = user ? true : false
- if (isSignIn) {
- token.username = user.username
- token.password = user.password
- }
- return token
- },
- async session({ session, token }) {
- return { ...session, user: { username: token.username } }
- },
- },
- secret: process.env.NEXTAUTH_SECRET,
- jwt: {
- secret: process.env.NEXTAUTH_SECRET,
- encryption: true, // Very important to encrypt the JWT, otherwise you're leaking username+password into the browser
- },
-})
-```
-
-The idea is that once one is authenticated with the LDAP server, one can pass through both the username/DN and password to the JWT stored in the browser.
-
-This is then passed back to any API routes and retrieved as such:
-
-```js title="/pages/api/doLDAPWork.js"
-token = await jwt.getToken({
- req,
- secret: process.env.NEXTAUTH_SECRET,
-})
-const { username, password } = token
-```
-
-> Thanks to [Winwardo](https://github.com/Winwardo) for the code example
diff --git a/www/docs/tutorials/refresh-token-rotation.md b/www/docs/tutorials/refresh-token-rotation.md
deleted file mode 100644
index fdce856392..0000000000
--- a/www/docs/tutorials/refresh-token-rotation.md
+++ /dev/null
@@ -1,137 +0,0 @@
----
-id: refresh-token-rotation
-title: Refresh Token Rotation
----
-
-While NextAuth.js doesn't automatically handle access token rotation for OAuth providers yet, this functionality can be implemented using [callbacks](https://next-auth.js.org/configuration/callbacks).
-
-## Source Code
-
-_A working example can be accessed [here](https://github.com/lawrencecchen/next-auth-refresh-tokens)._
-
-## Implementation
-
-### Server Side
-
-Using a [JWT callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) and a [session callback](https://next-auth.js.org/configuration/callbacks#session-callback), we can persist OAuth tokens and refresh them when they expire.
-
-Below is a sample implementation using Google's Identity Provider. Please note that the OAuth 2.0 request in the `refreshAccessToken()` function will vary between different providers, but the core logic should remain similar.
-
-```js title="pages/auth/[...nextauth.js]"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-const GOOGLE_AUTHORIZATION_URL =
- "https://accounts.google.com/o/oauth2/v2/auth?" +
- new URLSearchParams({
- prompt: "consent",
- access_type: "offline",
- response_type: "code",
- })
-
-/**
- * Takes a token, and returns a new token with updated
- * `accessToken` and `accessTokenExpires`. If an error occurs,
- * returns the old token and an error property
- */
-async function refreshAccessToken(token) {
- try {
- const url =
- "https://oauth2.googleapis.com/token?" +
- new URLSearchParams({
- client_id: process.env.GOOGLE_CLIENT_ID,
- client_secret: process.env.GOOGLE_CLIENT_SECRET,
- grant_type: "refresh_token",
- refresh_token: token.refreshToken,
- })
-
- const response = await fetch(url, {
- headers: {
- "Content-Type": "application/x-www-form-urlencoded",
- },
- method: "POST",
- })
-
- const refreshedTokens = await response.json()
-
- if (!response.ok) {
- throw refreshedTokens
- }
-
- return {
- ...token,
- accessToken: refreshedTokens.access_token,
- accessTokenExpires: Date.now() + refreshedTokens.expires_in * 1000,
- refreshToken: refreshedTokens.refresh_token ?? token.refreshToken, // Fall back to old refresh token
- }
- } catch (error) {
- console.log(error)
-
- return {
- ...token,
- error: "RefreshAccessTokenError",
- }
- }
-}
-
-export default NextAuth({
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- authorizationUrl: GOOGLE_AUTHORIZATION_URL,
- }),
- ],
- callbacks: {
- async jwt({ token, user, account }) {
- // Initial sign in
- if (account && user) {
- return {
- accessToken: account.access_token,
- accessTokenExpires: Date.now() + account.expires_in * 1000,
- refreshToken: account.refresh_token,
- user,
- }
- }
-
- // Return previous token if the access token has not expired yet
- if (Date.now() < token.accessTokenExpires) {
- return token
- }
-
- // Access token has expired, try to update it
- return refreshAccessToken(token)
- },
- async session({ session, token }) {
- session.user = token.user
- session.accessToken = token.accessToken
- session.error = token.error
-
- return session
- },
- },
-})
-```
-
-### Client Side
-
-The `RefreshAccessTokenError` error that is caught in the `refreshAccessToken()` method is passed all the way to the client. This means that you can direct the user to the sign in flow if we cannot refresh their token.
-
-We can handle this functionality as a side effect:
-
-```js title="pages/auth/[...nextauth.js]"
-import { signIn, useSession } from "next-auth/react";
-import { useEffect } from "react";
-
-const HomePage() {
- const { data: session } = useSession();
-
- useEffect(() => {
- if (session?.error === "RefreshAccessTokenError") {
- signIn(); // Force sign in to hopefully resolve error
- }
- }, [session]);
-
-return (...)
-}
-```
diff --git a/www/docs/tutorials/securing-pages-and-api-routes.md b/www/docs/tutorials/securing-pages-and-api-routes.md
deleted file mode 100644
index e0bc0f3bb5..0000000000
--- a/www/docs/tutorials/securing-pages-and-api-routes.md
+++ /dev/null
@@ -1,148 +0,0 @@
----
-id: securing-pages-and-api-routes
-title: Securing pages and API routes
----
-
-You can easily protect client and server side rendered pages and API routes with NextAuth.js.
-
-_You can find working examples of the approaches shown below in the [example project](https://github.com/nextauthjs/next-auth-example/)._
-
-:::tip
-The methods `getSession()` and `getToken()` both return an `object` if a session is valid and `null` if a session is invalid or has expired.
-:::
-
-## Securing Pages
-
-### Client Side
-
-If data on a page is fetched using calls to secure API routes - i.e. routes which use `getSession()` or `getToken()` to access the session - you can use the `useSession` React Hook to secure pages.
-
-```js title="pages/client-side-example.js"
-import { useSession, getSession } from "next-auth/react"
-
-export default function Page() {
- const { data: session, status } = useSession()
-
- if (status === "loading") {
- return
- >
- )
-}
-```
-
-### Server Side
-
-You can protect server side rendered pages using the `getSession()` method.
-
-```js title="pages/server-side-example.js"
-import { useSession, getSession } from "next-auth/react"
-
-export default function Page() {
- const { data: session } = useSession()
-
- if (typeof window !== "undefined") return null
-
- if (session) {
- return (
- <>
-
Protected Page
-
You can view this page because you are signed in.
- >
- )
- }
- return
Access Denied
-}
-
-export async function getServerSideProps(context) {
- return {
- props: {
- session: await getSession(context)
- },
- }
-}
-```
-
-:::tip
-When you supply a `session` prop in `_app.js`, `useSession` won't show a loading state, as it'll already have the session available. In this way, you can provide a more seamless user experience.
-
-```js title="pages/_app.js"
-import { SessionProvider } from "next-auth/react"
-
-export default function App({
- Component,
- pageProps: { session, ...pageProps }
-}) {
- return (
-
-
-
- )
-}
-```
-
-:::
-
-## Securing API Routes
-
-### Using getSession()
-
-You can protect API routes using the `getSession()` method.
-
-```js title="pages/api/get-session-example.js"
-import { getSession } from "next-auth/react"
-
-export default async (req, res) => {
- const session = await getSession({ req })
- if (session) {
- // Signed in
- console.log("Session", JSON.stringify(session, null, 2))
- } else {
- // Not Signed in
- res.status(401)
- }
- res.end()
-}
-```
-
-### Using getToken()
-
-If you are using JSON Web Tokens you can use the `getToken()` helper to access the contents of the JWT without having to handle JWT decryption / verification yourself. This method can only be used server side.
-
-```js title="pages/api/get-token-example.js"
-// This is an example of how to read a JSON Web Token from an API route
-import { getToken } from "next-auth/jwt"
-
-const secret = process.env.SECRET
-
-export default async (req, res) => {
- const token = await getToken({ req, secret })
- if (token) {
- // Signed in
- console.log("JSON Web Token", JSON.stringify(token, null, 2))
- } else {
- // Not Signed in
- res.status(401)
- }
- res.end()
-}
-```
-
-:::tip
-You can use the `getToken()` helper function in any application as long as you set the `NEXTAUTH_URL` environment variable and the application is able to read the JWT cookie (e.g. is on the same domain).
-:::
-
-:::note
-Pass `getToken` the same value for `secret` as specified in `pages/api/auth/[...nextauth].js`.
-
-See [the documentation for the JWT option](/configuration/options#jwt) for more information.
-:::
diff --git a/www/docs/tutorials/testing-with-cypress.md b/www/docs/tutorials/testing-with-cypress.md
deleted file mode 100644
index f6ed140475..0000000000
--- a/www/docs/tutorials/testing-with-cypress.md
+++ /dev/null
@@ -1,127 +0,0 @@
----
-id: testing-with-cypress
-title: Testing with Cypress
----
-
-To test an implementation of NextAuth.js, we encourage you to use [Cypress](https://cypress.io).
-
-## Setting up Cypress
-
-To get started, install the dependencies:
-
-`npm install --save-dev cypress cypress-social-logins @testing-library/cypress`
-
-:::note
-If you are using username/password based login, you will not need the `cypress-social-logins` dependency.
-:::
-
-Cypress will install and initialize the folder structure with example integration tests, a folder for plugins, etc.
-
-Next you will have to create some configuration files for Cypress.
-
-First, the primary cypress config:
-
-```js title="cypress.json"
-{
- "baseUrl": "http://localhost:3000",
- "chromeWebSecurity": false
-}
-```
-
-This initial Cypress config will tell Cypress where to find your site on initial launch as well as allow it to open up URLs at domains that aren't your page, for example to be able to login to a social provider.
-
-Second, a cypress file for environment variables. These can be defined in `cypress.json` under the key `env` as well, however since we're storing username / passwords in here we should keep those in a separate file and only commit `cypress.json` to version control, not `cypress.env.json`.
-
-```js title="cypress.env.json"
-{
- "GOOGLE_USER": "username@company.com",
- "GOOGLE_PW": "password",
- "COOKIE_NAME": "next-auth.session-token",
- "SITE_NAME": "http://localhost:3000"
-}
-```
-
-You must change the login credentials you want to use, but you can also redefine the name of the `GOOGLE_*` variables if you're using a different provider. `COOKIE_NAME`, however, must be set to that value for NextAuth.js.
-
-Third, if you're using the `cypress-social-logins` plugin, you must add this to your `/cypress/plugins/index.js` file like so:
-
-```js title="cypress/plugins/index.js"
-const { GoogleSocialLogin } = require('cypress-social-logins').plugins
-
-module.exports = (on, config) => {
- on('task', {
- GoogleSocialLogin: GoogleSocialLogin,
- })
-}
-```
-
-Finally, you can also add the following npm scripts to your `package.json`:
-
-```json
-"test:e2e:open": "cypress open",
-"test:e2e:run": "cypress run"
-```
-
-
-## Writing a test
-
-Once we've got all that configuration out of the way, we can begin writing tests to login using NextAuth.js.
-
-The basic login test looks like this:
-
-```js title="cypress/integration/login.js"
-describe('Login page', () => {
- before(() => {
- cy.log(`Visiting https://company.tld`)
- cy.visit('/')
- })
- it('Login with Google', () => {
- const username = Cypress.env('GOOGLE_USER')
- const password = Cypress.env('GOOGLE_PW')
- const loginUrl = Cypress.env('SITE_NAME')
- const cookieName = Cypress.env('COOKIE_NAME')
- const socialLoginOptions = {
- username,
- password,
- loginUrl,
- headless: true,
- logs: false,
- isPopup: true,
- loginSelector: `a[href="${Cypress.env(
- 'SITE_NAME'
- )}/api/auth/signin/google"]`,
- postLoginSelector: '.unread-count',
- }
-
- return cy
- .task('GoogleSocialLogin', socialLoginOptions)
- .then(({ cookies }) => {
- cy.clearCookies()
-
- const cookie = cookies
- .filter(cookie => cookie.name === cookieName)
- .pop()
- if (cookie) {
- cy.setCookie(cookie.name, cookie.value, {
- domain: cookie.domain,
- expiry: cookie.expires,
- httpOnly: cookie.httpOnly,
- path: cookie.path,
- secure: cookie.secure,
- })
-
- Cypress.Cookies.defaults({
- preserve: cookieName,
- })
-
- // remove the two lines below if you need to stay logged in
- // for your remaining tests
- cy.visit('/api/auth/signout')
- cy.get('form').submit()
- }
- })
- })
-})
-```
-
-Things to note here include, that you must adjust the CSS selector defined under `postLoginSelector` to match a selector found on your page after the user is logged in. This is how Cypress knows whether it succeeded or not. Also, if you're using another provider, you will have to adjust the `loginSelector` URL.
diff --git a/www/docs/tutorials/typeorm-custom-models.md b/www/docs/tutorials/typeorm-custom-models.md
deleted file mode 100644
index d6b3f43887..0000000000
--- a/www/docs/tutorials/typeorm-custom-models.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-id: typeorm-custom-models
-title: Custom models with TypeORM
----
-
-NextAuth.js provides a set of [models and schemas](/adapters/models) for the built-in TypeORM adapter that you can easily extend.
-
-You can use these models with MySQL, MariaDB, Postgres, MongoDB and SQLite.
-
-## Creating custom models
-
-```js title="models/User.js"
-import Adapters from "next-auth/adapters"
-
-// Extend the built-in models using class inheritance
-export default class User extends Adapters.TypeORM.Models.User.model {
- // You can extend the options in a model but you should not remove the base
- // properties or change the order of the built-in options on the constructor
- constructor(name, email, image, emailVerified) {
- super(name, email, image, emailVerified)
- }
-}
-
-export const UserSchema = {
- name: "User",
- target: User,
- columns: {
- ...Adapters.TypeORM.Models.User.schema.columns,
- // Adds a phoneNumber to the User schema
- phoneNumber: {
- type: "varchar",
- nullable: true,
- },
- },
-}
-```
-
-```js title="models/index.js"
-// To make importing them easier, you can export all models from single file
-import User, { UserSchema } from "./User"
-
-export default {
- User: {
- model: User,
- schema: UserSchema,
- },
-}
-```
-
-:::note
-[View source for built-in TypeORM models and schemas](https://github.com/nextauthjs/adapters/tree/main/packages/typeorm-legacy/src/models)
-:::
-
-## Using custom models
-
-You can use custom models by specifying the TypeORM adapter explicitly and passing them as an option.
-
-```js title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import Adapters from "next-auth/adapters"
-
-import Models from "../../../models"
-
-export default NextAuth({
- providers: [
- // Your providers
- ],
-
- adapter: Adapters.TypeORM.Adapter(
- // The first argument should be a database connection string or TypeORM config object
- "mysql://username:password@127.0.0.1:3306/database_name",
- // The second argument can be used to pass custom models and schemas
- {
- models: {
- User: Models.User,
- },
- }
- ),
-})
-```
diff --git a/www/docs/tutorials/usage-with-class-components.md b/www/docs/tutorials/usage-with-class-components.md
deleted file mode 100644
index 3e2007767b..0000000000
--- a/www/docs/tutorials/usage-with-class-components.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-id: usage-with-class-components
-title: Usage with class components
----
-
-If you want to use the `useSession()` hook in your class components you can do so with the help of a higher order component or with a render prop.
-
-## Higher Order Component
-
-```js
-import { useSession } from "next-auth/react"
-
-const withSession = (Component) => (props) => {
- const session = useSession()
-
- // if the component has a render property, we are good
- if (Component.prototype.render) {
- return
- }
-
- // if the passed component is a function component, there is no need for this wrapper
- throw new Error(
- [
- "You passed a function component, `withSession` is not needed.",
- "You can `useSession` directly in your component.",
- ].join("\n")
- )
-}
-
-// Usage
-class ClassComponent extends React.Component {
- render() {
- const { data: session, status } = this.props.session
- return null
- }
-}
-
-const ClassComponentWithSession = withSession(ClassComponent)
-```
-
-## Render Prop
-
-```js
-import { useSession } from "next-auth/react"
-
-const UseSession = ({ children }) => {
- const session = useSession()
- return children(session)
-}
-
-// Usage
-class ClassComponent extends React.Component {
- render() {
- return (
-
- {(session) => (
-
-
- )
-}
-
-const appCode = `
-import { SessionProvider } from "next-auth/react"
-
-export default App({
- Component, pageProps: { session, ...pageProps }
-}) {
- return (
-
-
-
- )
-}`.trim()
-
-const pageCode = `
-import { useSession, signIn, signOut } from "next-auth/react"
-
-export default function Component() {
- const { data: session } = useSession()
- if(session) {
- return <>
- Signed in as {session.user.email}
-
- >
- }
- return <>
- Not signed in
-
- >
-}`.trim()
-
-const serverlessFunctionCode = `
-import NextAuth from 'next-auth'
-import Providers from 'next-auth/providers'
-
-export default NextAuth({
- providers: [
- // OAuth authentication providers...
- Providers.Apple({
- clientId: process.env.APPLE_ID,
- clientSecret: process.env.APPLE_SECRET
- }),
- Providers.Facebook({
- clientId: process.env.FACEBOOK_ID,
- clientSecret: process.env.FACEBOOK_SECRET
- }),
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET
- }),
- // Passwordless / email sign in
- Providers.Email({
- server: process.env.MAIL_SERVER,
- from: 'NextAuth.js '
- }),
- ]
-})
-`.trim()
-
-export default Home
diff --git a/www/src/pages/index.module.css b/www/src/pages/index.module.css
deleted file mode 100644
index 3dacd26e49..0000000000
--- a/www/src/pages/index.module.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/* stylelint-disable docusaurus/copyright-header */
-/**
- * CSS files with the .module.css suffix will be treated as CSS modules
- * and scoped locally.
- */
-
-.heroBanner {
- padding: 4rem 0 0 0;
- text-align: center;
- position: relative;
-}
-
-@media screen and (max-width: 966px) {
- .heroBanner {
- padding: 2rem 2rem 0 2rem;
- }
-}
-
-.heroLogo {
- margin-bottom: 0.5rem;
- width: 8rem;
-}
-
-@media screen and (min-width: 689px) {
- .heroLogo {
- margin-bottom: -0.5rem;
- }
-}
-
-@media screen and (min-width: 689px) {
- .heroText {
- display: inline-block;
- margin: 1rem 1.5rem 0 2rem;
- }
-}
-
-.buttons {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 4rem 1rem 0 1rem;
-}
-
-.button {
- margin: 0 0.5rem;
-}
-
-.features {
- display: flex;
- align-items: center;
- padding-top: 4rem;
- margin: 0 auto 0 auto;
- width: 100%;
-}
-
-.featuresTitle {
- font-size: 2.5rem;
- line-height: 3rem;
- margin: 2rem 0 4rem 0;
- text-align: center;
- font-weight: 800 !important;
-}
-
-.featuresTitle span {
- display: inline-block;
- margin: 0 1rem;
-}
-
-@media screen and (max-width: 966px) {
- .featuresTitle span {
- display: block;
- margin: 1rem 0;
- }
-}
-
-.features h3 {
- font-size: 2rem;
- line-height: 4rem;
- margin: 1rem 0 2rem 0;
- font-weight: 800;
-}
-
-.features ul {
- list-style: none;
- text-align: center;
- padding: 0;
-}
-
-.features ul li {
- margin-top: 0.5rem;
- margin-bottom: 0.5rem;
- font-size: 1rem;
- white-space: nowrap;
- text-align: center;
-}
-
-.features ul li em {
- font-weight: 400;
- opacity: 0.8;
-}
-
-.featureImage {
- height: 220px;
- width: 220px;
-}
-
-.homeSubtitle {
- justify-content: center;
- padding: 0rem 0 2rem 0;
- opacity: 0.6;
- font-style: italic;
- margin: 0 auto;
- font-size: 1.2rem;
- text-align: center;
-}
diff --git a/www/src/pages/seo.js b/www/src/pages/seo.js
deleted file mode 100644
index f77e80df4b..0000000000
--- a/www/src/pages/seo.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from "react"
-import Head from "@docusaurus/Head"
-import useDocusaurusContext from "@docusaurus/useDocusaurusContext"
-
-const Seo = () => {
- const context = useDocusaurusContext()
- const { siteConfig = {} } = context
- const { title, tagline, url } = siteConfig
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- )
-}
-
-export default Seo
diff --git a/www/static/googlecfaeef9e241b87bc.html b/www/static/googlecfaeef9e241b87bc.html
deleted file mode 100644
index 8ec926836e..0000000000
--- a/www/static/googlecfaeef9e241b87bc.html
+++ /dev/null
@@ -1 +0,0 @@
-google-site-verification: googlecfaeef9e241b87bc.html
\ No newline at end of file
diff --git a/www/static/img/brand-github-inverted.svg b/www/static/img/brand-github-inverted.svg
deleted file mode 100644
index 2389767af3..0000000000
--- a/www/static/img/brand-github-inverted.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
diff --git a/www/static/img/brand-github.svg b/www/static/img/brand-github.svg
deleted file mode 100644
index b331f6d5aa..0000000000
--- a/www/static/img/brand-github.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
diff --git a/www/static/img/brand-npm-inverted.svg b/www/static/img/brand-npm-inverted.svg
deleted file mode 100644
index 88b8122561..0000000000
--- a/www/static/img/brand-npm-inverted.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/www/static/img/brand-npm.svg b/www/static/img/brand-npm.svg
deleted file mode 100644
index 53b24b89b8..0000000000
--- a/www/static/img/brand-npm.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/www/static/img/favicon-16x16.png b/www/static/img/favicon-16x16.png
deleted file mode 100644
index 67ecc06f46..0000000000
Binary files a/www/static/img/favicon-16x16.png and /dev/null differ
diff --git a/www/static/img/favicon-32x32.png b/www/static/img/favicon-32x32.png
deleted file mode 100644
index f52f61de00..0000000000
Binary files a/www/static/img/favicon-32x32.png and /dev/null differ
diff --git a/www/static/img/favicon.ico b/www/static/img/favicon.ico
deleted file mode 100644
index b3b1d64f97..0000000000
Binary files a/www/static/img/favicon.ico and /dev/null differ
diff --git a/www/static/img/logo.svg b/www/static/img/logo.svg
deleted file mode 100644
index 9db6d0d066..0000000000
--- a/www/static/img/logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/logo/logo-sm.png b/www/static/img/logo/logo-sm.png
deleted file mode 100644
index 67c21ae21d..0000000000
Binary files a/www/static/img/logo/logo-sm.png and /dev/null differ
diff --git a/www/static/img/logo/logo-xs.png b/www/static/img/logo/logo-xs.png
deleted file mode 100644
index 38d1c78c6f..0000000000
Binary files a/www/static/img/logo/logo-xs.png and /dev/null differ
diff --git a/www/static/img/logo/logo.png b/www/static/img/logo/logo.png
deleted file mode 100644
index 277048c84e..0000000000
Binary files a/www/static/img/logo/logo.png and /dev/null differ
diff --git a/www/static/img/nextauth_v4_schema.png b/www/static/img/nextauth_v4_schema.png
deleted file mode 100644
index b83e0603fb..0000000000
Binary files a/www/static/img/nextauth_v4_schema.png and /dev/null differ
diff --git a/www/static/img/nextjs-logo.svg b/www/static/img/nextjs-logo.svg
deleted file mode 100644
index 63c9500f90..0000000000
--- a/www/static/img/nextjs-logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/powered-by-vercel.svg b/www/static/img/powered-by-vercel.svg
deleted file mode 100644
index 6ed36d3b74..0000000000
--- a/www/static/img/powered-by-vercel.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/www/static/img/providers/apple-black.svg b/www/static/img/providers/apple-black.svg
deleted file mode 100644
index 9b1c580002..0000000000
--- a/www/static/img/providers/apple-black.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/www/static/img/providers/auth0.svg b/www/static/img/providers/auth0.svg
deleted file mode 100644
index a51cd9428c..0000000000
--- a/www/static/img/providers/auth0.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/www/static/img/providers/aws-cognito.svg b/www/static/img/providers/aws-cognito.svg
deleted file mode 100644
index 816b57db99..0000000000
--- a/www/static/img/providers/aws-cognito.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/battle.net.svg b/www/static/img/providers/battle.net.svg
deleted file mode 100644
index 2efa9f8139..0000000000
--- a/www/static/img/providers/battle.net.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/box.svg b/www/static/img/providers/box.svg
deleted file mode 100644
index 26b0e0fdbb..0000000000
--- a/www/static/img/providers/box.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/discord.svg b/www/static/img/providers/discord.svg
deleted file mode 100644
index 281dd3799d..0000000000
--- a/www/static/img/providers/discord.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/facebook-2.svg b/www/static/img/providers/facebook-2.svg
deleted file mode 100644
index 077bde6d92..0000000000
--- a/www/static/img/providers/facebook-2.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/github-1.svg b/www/static/img/providers/github-1.svg
deleted file mode 100644
index 0b10f82ea5..0000000000
--- a/www/static/img/providers/github-1.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
diff --git a/www/static/img/providers/gitlab.svg b/www/static/img/providers/gitlab.svg
deleted file mode 100644
index ab63afd262..0000000000
--- a/www/static/img/providers/gitlab.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/google-icon.svg b/www/static/img/providers/google-icon.svg
deleted file mode 100644
index 06dc52f0aa..0000000000
--- a/www/static/img/providers/google-icon.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/okta-3.svg b/www/static/img/providers/okta-3.svg
deleted file mode 100644
index 9771d9b950..0000000000
--- a/www/static/img/providers/okta-3.svg
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
diff --git a/www/static/img/providers/openid.svg b/www/static/img/providers/openid.svg
deleted file mode 100644
index 7658bf7167..0000000000
--- a/www/static/img/providers/openid.svg
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
diff --git a/www/static/img/providers/slack.svg b/www/static/img/providers/slack.svg
deleted file mode 100644
index 69a4eb6a21..0000000000
--- a/www/static/img/providers/slack.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/providers/spotify.svg b/www/static/img/providers/spotify.svg
deleted file mode 100644
index fc3a68bd46..0000000000
--- a/www/static/img/providers/spotify.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
diff --git a/www/static/img/providers/twitter.svg b/www/static/img/providers/twitter.svg
deleted file mode 100644
index c0364cc152..0000000000
--- a/www/static/img/providers/twitter.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
\ No newline at end of file
diff --git a/www/static/img/signin-complex.png b/www/static/img/signin-complex.png
deleted file mode 100644
index 4da2efefdd..0000000000
Binary files a/www/static/img/signin-complex.png and /dev/null differ
diff --git a/www/static/img/signin.png b/www/static/img/signin.png
deleted file mode 100644
index 9e0c25757d..0000000000
Binary files a/www/static/img/signin.png and /dev/null differ
diff --git a/www/static/img/social-media-card.png b/www/static/img/social-media-card.png
deleted file mode 100644
index 59aa5ed3c1..0000000000
Binary files a/www/static/img/social-media-card.png and /dev/null differ
diff --git a/www/static/img/undraw_authentication.svg b/www/static/img/undraw_authentication.svg
deleted file mode 100644
index 8b8246ea26..0000000000
--- a/www/static/img/undraw_authentication.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/undraw_secure.svg b/www/static/img/undraw_secure.svg
deleted file mode 100644
index cc68b4f87c..0000000000
--- a/www/static/img/undraw_secure.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/static/img/undraw_social.svg b/www/static/img/undraw_social.svg
deleted file mode 100644
index 60d4996881..0000000000
--- a/www/static/img/undraw_social.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/www/vercel.json b/www/vercel.json
deleted file mode 100644
index 04b5e6e72a..0000000000
--- a/www/vercel.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "redirects": [
- {
- "source": "/schemas/models",
- "destination": "/adapters/models",
- "permanent": true
- },
- {
- "source": "/schemas/mysql",
- "destination": "/adapters/typeorm/mysql",
- "permanent": true
- },
- {
- "source": "/schemas/postgres",
- "destination": "/adapters/typeorm/postgres",
- "permanent": true
- },
- {
- "source": "/schemas/mssql",
- "destination": "/adapters/typeorm/mssql",
- "permanent": true
- },
- {
- "source": "/schemas/mongodb",
- "destination": "/adapters/typeorm/mongodb",
- "permanent": true
- },
- {
- "source": "/schemas/adapters",
- "destination": "/adapters/overview",
- "permanent": true
- }
- ]
-}
diff --git a/www/versioned_docs/version-v3/adapters/dynamodb.md b/www/versioned_docs/version-v3/adapters/dynamodb.md
deleted file mode 100644
index 891a8cae5f..0000000000
--- a/www/versioned_docs/version-v3/adapters/dynamodb.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-id: dynamodb
-title: DynamoDB Adapter
----
-
-# DynamoDB
-
-This is the AWS DynamoDB Adapter for next-auth. This package can only be used in conjunction with the primary next-auth package. It is not a standalone package.
-
-You need a table with a partition key `pk` and a sort key `sk`. Your table also needs a global secondary index named `GSI1` with `GSI1PK` as partition key and `GSI1SK` as sorting key. You can set whatever you want as the table name and the billing method.
-
-You can find the full schema in the table structure section below.
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/dynamodb-adapter@canary`
-
-```js
-npm install next-auth @next-auth/dynamodb-adapter@canary
-```
-
-2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object.
-
-You need to pass `DocumentClient` instance from `aws-sdk` to the adapter.
-The default table name is `next-auth`, but you can customise that by passing `{ tableName: 'your-table-name' }` as the second parameter in the adapter.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import AWS from "aws-sdk";
-import NextAuth from "next-auth";
-import Providers from "next-auth/providers";
-import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter"
-
-AWS.config.update({
- accessKeyId: process.env.NEXT_AUTH_AWS_ACCESS_KEY,
- secretAccessKey: process.env.NEXT_AUTH_AWS_SECRET_KEY,
- region: process.env.NEXT_AUTH_AWS_REGION,
-});
-
-export default NextAuth({
- // Configure one or more authentication providers
- providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_ID,
- clientSecret: process.env.GITHUB_SECRET,
- }),
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- }),
- // ...add more providers here
- ],
- adapter: DynamoDBAdapter(
- new AWS.DynamoDB.DocumentClient()
- ),
- ...
-});
-```
-
-(AWS secrets start with `NEXT_AUTH_` in order to not conflict with [Vercel's reserved environment variables](https://vercel.com/docs/environment-variables#reserved-environment-variables).)
-
-## Schema
-
-The table respects the single table design pattern. This has many advantages:
-
-- Only one table to manage, monitor and provision.
-- Querying relations is faster than with multi-table schemas (for eg. retrieving all sessions for a user).
-- Only one table needs to be replicated, if you want to go multi-region.
-
-Here is a schema of the table :
-
-![DynamoDB Table](https://i.imgur.com/hGZtWDq.png)
diff --git a/www/versioned_docs/version-v3/adapters/fauna.md b/www/versioned_docs/version-v3/adapters/fauna.md
deleted file mode 100644
index 9bb0ffb163..0000000000
--- a/www/versioned_docs/version-v3/adapters/fauna.md
+++ /dev/null
@@ -1,84 +0,0 @@
----
-id: fauna
-title: FaunaDB Adapter
----
-
-# FaunaDB
-
-This is the Fauna Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-You can find the Fauna schema and seed information in the docs at [next-auth.js.org/adapters/fauna](https://next-auth.js.org/adapters/fauna).
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/fauna-adapter@canary`
-
-```js
-npm install next-auth @next-auth/fauna-adapter@canary
-```
-
-2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import * as Fauna from "faunadb"
-import { FaunaAdapter } from "@next-auth/fauna-adapter"
-
-const client = new Fauna.Client({
- secret: "secret",
- scheme: "http",
- domain: "localhost",
- port: 8443,
-})
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: FaunaAdapter({ faunaClient: client})
- ...
-})
-```
-
-## Schema
-
-```javascript
-CreateCollection({ name: "accounts" })
-CreateCollection({ name: "sessions" })
-CreateCollection({ name: "users" })
-CreateCollection({ name: "verification_requests" })
-CreateIndex({
- name: "account_by_provider_account_id",
- source: Collection("accounts"),
- unique: true,
- terms: [
- { field: ["data", "providerId"] },
- { field: ["data", "providerAccountId"] },
- ],
-})
-CreateIndex({
- name: "session_by_token",
- source: Collection("sessions"),
- unique: true,
- terms: [{ field: ["data", "sessionToken"] }],
-})
-CreateIndex({
- name: "user_by_email",
- source: Collection("users"),
- unique: true,
- terms: [{ field: ["data", "email"] }],
-})
-CreateIndex({
- name: "verification_request_by_token",
- source: Collection("verification_requests"),
- unique: true,
- terms: [{ field: ["data", "token"] }, { field: ["data", "identifier"] }],
-})
-```
diff --git a/www/versioned_docs/version-v3/adapters/firebase.md b/www/versioned_docs/version-v3/adapters/firebase.md
deleted file mode 100644
index 4cded93ca1..0000000000
--- a/www/versioned_docs/version-v3/adapters/firebase.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-id: firebase
-title: Firebase Adapter
----
-
-# Firebase
-
-This is the Firebase Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-## Getting Started
-
-1. Install `next-auth` and `@next-auth/firebase-adapter@canary`
-
-```js
-npm install next-auth @next-auth/firebase-adapter@canary
-```
-
-2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { FirebaseAdapter } from "@next-auth/firebase-adapter"
-
-import firebase from "firebase/app"
-import "firebase/firestore"
-
-const firestore = (
- firebase.apps[0] ?? firebase.initializeApp(/* your config */)
-).firestore()
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: FirebaseAdapter(firestore),
- ...
-})
-```
-
-## Options
-
-When initializing the firestore adapter, you must pass in the firebase config object with the details from your project. More details on how to obtain that config object can be found [here](https://support.google.com/firebase/answer/7015592).
-
-An example firebase config looks like this:
-
-```js
-const firebaseConfig = {
- apiKey: "AIzaSyDOCAbC123dEf456GhI789jKl01-MnO",
- authDomain: "myapp-project-123.firebaseapp.com",
- databaseURL: "https://myapp-project-123.firebaseio.com",
- projectId: "myapp-project-123",
- storageBucket: "myapp-project-123.appspot.com",
- messagingSenderId: "65211879809",
- appId: "1:65211879909:web:3ae38ef1cdcb2e01fe5f0c",
- measurementId: "G-8GSGZQ44ST",
-}
-```
-
-See [firebase.google.com/docs/web/setup](https://firebase.google.com/docs/web/setup) for more details.
-
-:::tip **From Firebase**
-
-**Caution**: We do not recommend manually modifying an app's Firebase config file or object. If you initialize an app with invalid or missing values for any of these required "Firebase options", then your end users may experience serious issues.
-
-For open source projects, we generally do not recommend including the app's Firebase config file or object in source control because, in most cases, your users should create their own Firebase projects and point their apps to their own Firebase resources (via their own Firebase config file or object).
-:::
diff --git a/www/versioned_docs/version-v3/adapters/models.md b/www/versioned_docs/version-v3/adapters/models.md
deleted file mode 100644
index 148a59e482..0000000000
--- a/www/versioned_docs/version-v3/adapters/models.md
+++ /dev/null
@@ -1,62 +0,0 @@
----
-id: models
-title: Models
----
-
-Models in NextAuth.js are built for ANSI SQL but are polymorphic and are transformed to adapt to the database being used; there is some variance in specific data types (e.g. for datetime, text fields, etc) but they are functionally the same with as much parity in behaviour as possible.
-
-All table/collection names in the built in models are plural, and all table names and column names use `snake_case` when used with an SQL database and `camelCase` when used with Document database.
-
-:::note
-You can [extend the built in models](/tutorials/typeorm-custom-models) and even [create your own database adapter](/tutorials/creating-a-database-adapter) if you want to use NextAuth.js with a database that is not supported out of the box.
-:::
-
----
-
-## User
-
-Table: `users`
-
-**Description:**
-
-The User model is for information such as the users name and email address.
-
-Email address are optional, but if one is specified for a User then it must be unique.
-
-:::note
-If a user first signs in with OAuth then their email address is automatically populated using the one from their OAuth profile, if the OAuth provider returns one.
-
-This provides a way to contact users and for users to maintain access to their account and sign in using email in the event they are unable to sign in with the OAuth provider in future (if email sign in is configured).
-:::
-
-## Account
-
-Table: `accounts`
-
-**Description:**
-
-The Account model is for information about OAuth accounts associated with a User.
-
-A single User can have multiple Accounts, each Account can only have one User.
-
-## Session
-
-Table: `sessions`
-
-**Description:**
-
-The Session model is used for database sessions. It is not used if JSON Web Tokens are enabled.
-
-A single User can have multiple Sessions, each Session can only have one User.
-
-## Verification Request
-
-Table: `verification_requests`
-
-**Description:**
-
-The Verification Request model is used to store tokens for passwordless sign in emails.
-
-A single User can have multiple open Verification Requests (e.g. to sign in to different devices).
-
-It has been designed to be extendable for other verification purposes in future (e.g. 2FA / short codes).
diff --git a/www/versioned_docs/version-v3/adapters/overview.md b/www/versioned_docs/version-v3/adapters/overview.md
deleted file mode 100644
index be117bf02f..0000000000
--- a/www/versioned_docs/version-v3/adapters/overview.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-id: overview
-title: Overview
----
-
-An **Adapter** in NextAuth.js connects your application to whatever database or backend system you want to use to store data for user accounts, sessions, etc.
-
-The adapters can be found in their own repository under [`nextauthjs/adapters`](https://github.com/nextauthjs/adapters).
-
-There you can find the following adapters:
-
-- [`typeorm-legacy`](./typeorm/typeorm-overview)
-- [`prisma`](./prisma)
-- [`prisma-legacy`](./prisma-legacy)
-- [`fauna`](./fauna)
-- [`dynamodb`](./dynamodb)
-- [`firebase`](./firebase)
-
-## Custom Adapter
-
-See the tutorial for [creating a database Adapter](/tutorials/creating-a-database-adapter) for more information on how to create a custom Adapter. Have a look at the [Adapter repository](https://github.com/nextauthjs/adapters) to see community maintained custom Adapter or add your own.
-
-### Editor integration
-
-When writing your own custom Adapter in plain JavaScript, note that you can use **JSDoc** to get helpful editor hints and auto-completion like so:
-
-```js
-/** @type { import("next-auth/adapters").Adapter } */
-const MyAdapter = () => {
- return {
- async getAdapter() {
- return {
- // your adapter methods here
- }
- },
- }
-}
-```
-
-:::note
-This will work in code editors with a strong TypeScript integration like VSCode or WebStorm. It might not work if you're using more lightweight editors like VIM or Atom.
-:::
diff --git a/www/versioned_docs/version-v3/adapters/pouchdb.md b/www/versioned_docs/version-v3/adapters/pouchdb.md
deleted file mode 100644
index 5297fc1e94..0000000000
--- a/www/versioned_docs/version-v3/adapters/pouchdb.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-id: pouchdb
-title: PouchDB Adapter
----
-
-# PouchDB
-
-This is the PouchDB Adapter for [`next-auth`](https://next-auth.js.org). This package can only be used in conjunction with the primary `next-auth` package. It is not a standalone package.
-
-Depending on your architecture you can use PouchDB's http adapter to reach any database compliant with the CouchDB protocol (CouchDB, Cloudant, ...) or use any other PouchDB compatible adapter (leveldb, in-memory, ...)
-
-## Getting Started
-
-> **Prerequesite**: Your PouchDB instance MUST provide the `pouchdb-find` plugin since it is used internally by the adapter to build and manage indexes
-
-1. Install `next-auth` and `@next-auth/pouchdb-adapter@canary`
-
-```js
-npm install next-auth @next-auth/pouchdb-adapter@canary
-```
-
-2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { PouchDBAdapter } from "@next-auth/pouchdb-adapter"
-import PouchDB from "pouchdb"
-
-// Setup your PouchDB instance and database
-PouchDB.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter
- .plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin
-
-const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" })
-
-// For more information on each option (and a full list of options) go to
-// https://next-auth.js.org/configuration/options
-export default NextAuth({
- // https://next-auth.js.org/configuration/providers
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- }),
- ],
- adapter: PouchDBAdapter(pouchdb),
- // ...
-})
-```
-
-## Advanced
-
-### Memory-First Caching Strategy
-
-If you need to boost your authentication layer performance, you may use PouchDB's powerful sync features and various adapters, to build a memory-first caching strategy.
-
-Use an in-memory PouchDB as your main authentication database, and synchronize it with any other persisted PouchDB. You may do a one way, one-off replication at startup from the persisted PouchDB into the in-memory PouchDB, then two-way, continuous, retriable sync.
-
-This will most likely not increase performance much in a serverless environment due to various reasons such as concurrency, function startup time increases, etc.
-
-For more details, please see https://pouchdb.com/api.html#sync
diff --git a/www/versioned_docs/version-v3/adapters/prisma-legacy.md b/www/versioned_docs/version-v3/adapters/prisma-legacy.md
deleted file mode 100644
index 6b9e8ce4f5..0000000000
--- a/www/versioned_docs/version-v3/adapters/prisma-legacy.md
+++ /dev/null
@@ -1,174 +0,0 @@
----
-id: prisma-legacy
-title: Prisma Adapter (Legacy)
----
-
-# Prisma (Legacy)
-
-You can also use NextAuth.js with the built-in Adapter for [Prisma](https://www.prisma.io/docs/). This is included in the core `next-auth` package at the moment. The other adapter needs to be installed from its own additional package.
-
-:::info
-You may have noticed there is a `prisma` and `prisma-legacy` adapter. This is due to historical reasons, but the code has mostly converged so that there is no longer much difference between the two. The legacy adapter, however, does have the ability to rename tables which the newer version does not.
-:::
-
-To use this Adapter, you need to install Prisma Client and Prisma CLI:
-
-```
-npm install @prisma/client
-npm install prisma --save-dev
-```
-
-Configure your NextAuth.js to use the Prisma Adapter:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import Adapters from "next-auth/adapters"
-import { PrismaClient } from "@prisma/client"
-
-const prisma = new PrismaClient()
-
-export default NextAuth({
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- }),
- ],
- adapter: Adapters.Prisma.Adapter({ prisma }),
-})
-```
-
-:::tip
-While Prisma includes an experimental feature in the migration command that is able to generate SQL from a schema, creating tables and columns using the provided SQL is currently recommended instead as SQL schemas automatically generated by Prisma may differ from the recommended schemas.
-:::
-Schema for the Prisma Adapter
-
-## Setup
-
-Create a schema file in `prisma/schema.prisma` similar to this one:
-
-```json title="schema.prisma"
-generator client {
- provider = "prisma-client-js"
-}
-
-datasource db {
- provider = "sqlite"
- url = "file:./dev.db"
-}
-
-model Account {
- id Int @id @default(autoincrement())
- compoundId String @unique @map(name: "compound_id")
- userId Int @map(name: "user_id")
- providerType String @map(name: "provider_type")
- providerId String @map(name: "provider_id")
- providerAccountId String @map(name: "provider_account_id")
- refreshToken String? @map(name: "refresh_token")
- accessToken String? @map(name: "access_token")
- accessTokenExpires DateTime? @map(name: "access_token_expires")
- createdAt DateTime @default(now()) @map(name: "created_at")
- updatedAt DateTime @default(now()) @map(name: "updated_at")
-
- @@index([providerAccountId], name: "providerAccountId")
- @@index([providerId], name: "providerId")
- @@index([userId], name: "userId")
- @@map(name: "accounts")
-}
-
-model Session {
- id Int @id @default(autoincrement())
- userId Int @map(name: "user_id")
- expires DateTime
- sessionToken String @unique @map(name: "session_token")
- accessToken String @unique @map(name: "access_token")
- createdAt DateTime @default(now()) @map(name: "created_at")
- updatedAt DateTime @default(now()) @map(name: "updated_at")
-
- @@map(name: "sessions")
-}
-
-model User {
- id Int @id @default(autoincrement())
- name String?
- email String? @unique
- emailVerified DateTime? @map(name: "email_verified")
- image String?
- createdAt DateTime @default(now()) @map(name: "created_at")
- updatedAt DateTime @default(now()) @map(name: "updated_at")
-
- @@map(name: "users")
-}
-
-model VerificationRequest {
- id Int @id @default(autoincrement())
- identifier String
- token String @unique
- expires DateTime
- createdAt DateTime @default(now()) @map(name: "created_at")
- updatedAt DateTime @default(now()) @map(name: "updated_at")
-
- @@map(name: "verification_requests")
-}
-
-
-```
-
-### Generate Client
-
-Once you have saved your schema, use the Prisma CLI to generate the Prisma Client:
-
-```
-npx prisma generate
-```
-
-To configure you database to use the new schema (i.e. create tables and columns) use the `prisma migrate` command:
-
-```
-npx prisma migrate dev
-```
-
-To generate a schema in this way with the above example code, you will need to specify your database connection string in the environment variable `DATABASE_URL`. You can do this by setting it in a `.env` file at the root of your project.
-
-As this feature is experimental in Prisma, it is behind a feature flag. You should check your database schema manually after using this option. See the [Prisma documentation](https://www.prisma.io/docs/) for information on how to use `prisma migrate`.
-
-:::tip
-If you experience issues with Prisma opening too many database connections in local development mode (e.g. due to Hot Module Reloading) you can use an approach like this when initalising the Prisma Client:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-let prisma
-
-if (process.env.NODE_ENV === "production") {
- prisma = new PrismaClient()
-} else {
- if (!global.prisma) {
- global.prisma = new PrismaClient()
- }
- prisma = global.prisma
-}
-```
-
-:::
-
-### Custom Models
-
-You can add properties to the schema and map them to any database column names you wish, but you should not change the base properties or types defined in the example schema.
-
-The model names themselves can be changed with a configuration option, and the datasource can be changed to anything supported by Prisma.
-
-You can use custom model names by using the `modelMapping` option (shown here with default values).
-
-```javascript title="pages/api/auth/[...nextauth].js"
-...
-adapter: Adapters.Prisma.Adapter({
- prisma,
- modelMapping: {
- User: 'user',
- Account: 'account',
- Session: 'session',
- VerificationRequest: 'verificationRequest'
- }
-})
-...
-```
diff --git a/www/versioned_docs/version-v3/adapters/prisma.md b/www/versioned_docs/version-v3/adapters/prisma.md
deleted file mode 100644
index 73c55846e7..0000000000
--- a/www/versioned_docs/version-v3/adapters/prisma.md
+++ /dev/null
@@ -1,218 +0,0 @@
----
-id: prisma
-title: Prisma Adapter
----
-
-# Prisma
-
-You can also use NextAuth.js with the new experimental Adapter for [Prisma](https://www.prisma.io/docs/). This version of the Prisma Adapter is not included in the core `next-auth` package, and must be installed separately.
-
-:::info
-You may have noticed there is a `prisma` and `prisma-legacy` adapter. This is due to historical reasons, but the code has mostly converged so that there is no longer much difference between the two. The legacy adapter, however, does have the ability to rename tables which the newer version does not.
-:::
-
-To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate `@next-auth/prisma-adapter@canary` package:
-
-```
-npm install @prisma/client @next-auth/prisma-adapter@canary
-npm install prisma --save-dev
-```
-
-Configure your NextAuth.js to use the Prisma Adapter:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import { PrismaAdapter } from "@next-auth/prisma-adapter"
-import { PrismaClient } from "@prisma/client"
-
-const prisma = new PrismaClient()
-
-export default NextAuth({
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- }),
- ],
- adapter: PrismaAdapter(prisma),
-})
-```
-
-:::tip
-While Prisma includes an experimental feature in the migration command that is able to generate SQL from a schema, creating tables and columns using the provided SQL is currently recommended instead as SQL schemas automatically generated by Prisma may differ from the recommended schemas.
-:::
-Schema for the Prisma Adapter (`@next-auth/prisma-adapter`)
-
-## Setup
-
-Create a schema file in `prisma/schema.prisma` similar to this one:
-
-```json title="schema.prisma"
-generator client {
- provider = "prisma-client-js"
-}
-
-datasource db {
- provider = "sqlite"
- url = "file:./dev.db"
-}
-
-model Account {
- id String @id @default(cuid())
- userId String
- providerType String
- providerId String
- providerAccountId String
- refreshToken String?
- accessToken String?
- accessTokenExpires DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- user User @relation(fields: [userId], references: [id])
-
- @@unique([providerId, providerAccountId])
-}
-
-model Session {
- id String @id @default(cuid())
- userId String
- expires DateTime
- sessionToken String @unique
- accessToken String @unique
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- user User @relation(fields: [userId], references: [id])
-}
-
-model User {
- id String @id @default(cuid())
- name String?
- email String? @unique
- emailVerified DateTime?
- image String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- accounts Account[]
- sessions Session[]
-}
-
-model VerificationRequest {
- id String @id @default(cuid())
- identifier String
- token String @unique
- expires DateTime
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- @@unique([identifier, token])
-}
-
-```
-
-### Generate Client
-
-Once you have saved your schema, use the Prisma CLI to generate the Prisma Client:
-
-```
-npx prisma generate
-```
-
-To configure you database to use the new schema (i.e. create tables and columns) use the `prisma migrate` command:
-
-```
-npx prisma migrate dev
-```
-
-To generate a schema in this way with the above example code, you will need to specify your database connection string in the environment variable `DATABASE_URL`. You can do this by setting it in a `.env` file at the root of your project.
-
-As this feature is experimental in Prisma, it is behind a feature flag. You should check your database schema manually after using this option. See the [Prisma documentation](https://www.prisma.io/docs/) for information on how to use `prisma migrate`.
-
-## Schema History
-
-Changes from the original Prisma Adapter
-
-```diff
- model Account {
-- id Int @default(autoincrement()) @id
-+ id String @id @default(cuid())
-- compoundId String @unique @map(name: "compound_id")
-- userId Int @map(name: "user_id")
-+ userId String
-+ user User @relation(fields: [userId], references: [id])
-- providerType String @map(name: "provider_type")
-+ providerType String
-- providerId String @map(name: "provider_id")
-+ providerId String
-- providerAccountId String @map(name: "provider_account_id")
-+ providerAccountId String
-- refreshToken String? @map(name: "refresh_token")
-+ refreshToken String?
-- accessToken String? @map(name: "access_token")
-+ accessToken String?
-- accessTokenExpires DateTime? @map(name: "access_token_expires")
-+ accessTokenExpires DateTime?
-- createdAt DateTime @default(now()) @map(name: "created_at")
-+ createdAt DateTime @default(now())
-- updatedAt DateTime @default(now()) @map(name: "updated_at")
-+ updatedAt DateTime @updatedAt
-
-- @@index([providerAccountId], name: "providerAccountId")
-- @@index([providerId], name: "providerId")
-- @@index([userId], name: "userId")
-- @@map(name: "accounts")
-+ @@unique([providerId, providerAccountId])
- }
-
- model Session {
-- id Int @default(autoincrement()) @id
-+ id String @id @default(cuid())
-- userId Int @map(name: "user_id")
-+ userId String
-+ user User @relation(fields: [userId], references: [id])
- expires DateTime
-- sessionToken String @unique @map(name: "session_token")
-+ sessionToken String @unique
-- accessToken String @unique @map(name: "access_token")
-+ accessToken String @unique
-- createdAt DateTime @default(now()) @map(name: "created_at")
-+ createdAt DateTime @default(now())
-- updatedAt DateTime @default(now()) @map(name: "updated_at")
-+ updatedAt DateTime @updatedAt
--
-- @@map(name: "sessions")
- }
-
- model User {
-- id Int @default(autoincrement()) @id
-+ id String @id @default(cuid())
- name String?
- email String? @unique
-- emailVerified DateTime? @map(name: "email_verified")
-+ emailVerified DateTime?
- image String?
-+ accounts Account[]
-+ sessions Session[]
-- createdAt DateTime @default(now()) @map(name: "created_at")
-+ createdAt DateTime @default(now())
-- updatedAt DateTime @default(now()) @map(name: "updated_at")
-+ updatedAt DateTime @updatedAt
-
-- @@map(name: "users")
- }
-
- model VerificationRequest {
-- id Int @default(autoincrement()) @id
-+ id String @id @default(cuid())
- identifier String
- token String @unique
- expires DateTime
-- createdAt DateTime @default(now()) @map(name: "created_at")
-+ createdAt DateTime @default(now())
-- updatedAt DateTime @default(now()) @map(name: "updated_at")
-+ updatedAt DateTime @updatedAt
-
-- @@map(name: "verification_requests")
-+ @@unique([identifier, token])
- }
-```
diff --git a/www/versioned_docs/version-v3/adapters/typeorm/mongodb.md b/www/versioned_docs/version-v3/adapters/typeorm/mongodb.md
deleted file mode 100644
index 5bf0abaef4..0000000000
--- a/www/versioned_docs/version-v3/adapters/typeorm/mongodb.md
+++ /dev/null
@@ -1,22 +0,0 @@
----
-id: mongodb
-title: MongoDB
----
-
-MongoDB is a document database and does not use schemas in the same way as most RDBMS databases.
-
-**In MongoDB as collections and indexes are created automatically.**
-
-## Objects in MongoDB
-
-Objects stored in MongoDB use similar datatypes to SQL, with some differences:
-
-1. ID fields are of type `ObjectID` rather than type `int`.
-
-2. All collection names and property names use `camelCase` rather than `snake_case`.
-
-3. All timestamps are stored as `ISODate()` in MongoDB and all date/time values are stored in UTC.
-
-4. A sparse index is used on the User `email` property to allow it to be optional, while still enforcing uniqueness if it is specified.
-
-This is functionally equivalent to the ANSI SQL behaviour for a `unique` but `nullable` property.
diff --git a/www/versioned_docs/version-v3/adapters/typeorm/mssql.md b/www/versioned_docs/version-v3/adapters/typeorm/mssql.md
deleted file mode 100644
index 387261c56d..0000000000
--- a/www/versioned_docs/version-v3/adapters/typeorm/mssql.md
+++ /dev/null
@@ -1,88 +0,0 @@
----
-id: mssql
-title: Microsoft SQL Server
----
-
-Schema for a Microsoft SQL Server (mssql) database.
-
-:::note
-When using a Microsoft SQL Server database with the default adapter (TypeORM) all properties of type `timestamp` are transformed to `datetime`.
-
-This transform is also applied to any properties of type `timestamp` when using custom models.
-:::
-
-```sql
-CREATE TABLE accounts
- (
- id int IDENTITY(1,1) NOT NULL,
- compound_id varchar(255) NOT NULL,
- user_id int NOT NULL,
- provider_type varchar(255) NOT NULL,
- provider_id varchar(255) NOT NULL,
- provider_account_id varchar(255) NOT NULL,
- refresh_token text NULL,
- access_token text NULL,
- access_token_expires datetime NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE sessions
- (
- id int IDENTITY(1,1) NOT NULL,
- user_id int NOT NULL,
- expires datetime NOT NULL,
- session_token varchar(255) NOT NULL,
- access_token varchar(255) NOT NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE users
- (
- id int IDENTITY(1,1) NOT NULL,
- name varchar(255) NULL,
- email varchar(255) NULL,
- email_verified datetime NULL,
- image varchar(255) NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE TABLE verification_requests
- (
- id int IDENTITY(1,1) NOT NULL,
- identifier varchar(255) NOT NULL,
- token varchar(255) NOT NULL,
- expires datetime NOT NULL,
- created_at datetime NOT NULL DEFAULT getdate(),
- updated_at datetime NOT NULL DEFAULT getdate()
- );
-
-CREATE UNIQUE INDEX compound_id
- ON accounts(compound_id);
-
-CREATE INDEX provider_account_id
- ON accounts(provider_account_id);
-
-CREATE INDEX provider_id
- ON accounts(provider_id);
-
-CREATE INDEX user_id
- ON accounts(user_id);
-
-CREATE UNIQUE INDEX session_token
- ON sessions(session_token);
-
-CREATE UNIQUE INDEX access_token
- ON sessions(access_token);
-
-CREATE UNIQUE INDEX email
- ON users(email);
-
-CREATE UNIQUE INDEX token
- ON verification_requests(token);
-```
-
-When using NextAuth.js with SQL Server for the first time, run NextAuth.js once against your database with `?synchronize=true` on the connection string and export the schema that is created.
-:::
diff --git a/www/versioned_docs/version-v3/adapters/typeorm/mysql.md b/www/versioned_docs/version-v3/adapters/typeorm/mysql.md
deleted file mode 100644
index 4041ba8417..0000000000
--- a/www/versioned_docs/version-v3/adapters/typeorm/mysql.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-id: mysql
-title: MySQL
----
-
-Schema for a MySQL database.
-
-:::note
-When using a MySQL database with the default adapter (TypeORM) all timestamp columns use 6 digits of precision (unless another value for `precision` is specified in the schema) and the timezone is set to `Z` (aka Zulu Time / UTC) and all timestamps are stored in UTC.
-:::
-
-```sql
-CREATE TABLE accounts
- (
- id INT NOT NULL AUTO_INCREMENT,
- compound_id VARCHAR(255) NOT NULL,
- user_id INTEGER NOT NULL,
- provider_type VARCHAR(255) NOT NULL,
- provider_id VARCHAR(255) NOT NULL,
- provider_account_id VARCHAR(255) NOT NULL,
- refresh_token TEXT,
- access_token TEXT,
- access_token_expires TIMESTAMP(6),
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- PRIMARY KEY (id)
- );
-
-CREATE TABLE sessions
- (
- id INT NOT NULL AUTO_INCREMENT,
- user_id INTEGER NOT NULL,
- expires TIMESTAMP(6) NOT NULL,
- session_token VARCHAR(255) NOT NULL,
- access_token VARCHAR(255) NOT NULL,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- PRIMARY KEY (id)
- );
-
-CREATE TABLE users
- (
- id INT NOT NULL AUTO_INCREMENT,
- name VARCHAR(255),
- email VARCHAR(255),
- email_verified TIMESTAMP(6),
- image VARCHAR(255),
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- PRIMARY KEY (id)
- );
-
-CREATE TABLE verification_requests
- (
- id INT NOT NULL AUTO_INCREMENT,
- identifier VARCHAR(255) NOT NULL,
- token VARCHAR(255) NOT NULL,
- expires TIMESTAMP(6) NOT NULL,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- PRIMARY KEY (id)
- );
-
-CREATE UNIQUE INDEX compound_id
- ON accounts(compound_id);
-
-CREATE INDEX provider_account_id
- ON accounts(provider_account_id);
-
-CREATE INDEX provider_id
- ON accounts(provider_id);
-
-CREATE INDEX user_id
- ON accounts(user_id);
-
-CREATE UNIQUE INDEX session_token
- ON sessions(session_token);
-
-CREATE UNIQUE INDEX access_token
- ON sessions(access_token);
-
-CREATE UNIQUE INDEX email
- ON users(email);
-
-CREATE UNIQUE INDEX token
- ON verification_requests(token);
-```
diff --git a/www/versioned_docs/version-v3/adapters/typeorm/overview.md b/www/versioned_docs/version-v3/adapters/typeorm/overview.md
deleted file mode 100644
index 733093b954..0000000000
--- a/www/versioned_docs/version-v3/adapters/typeorm/overview.md
+++ /dev/null
@@ -1,49 +0,0 @@
----
-id: typeorm-overview
-title: Overview
----
-
-## TypeORM Adapter
-
-NextAuth.js comes with a default Adapter that uses [TypeORM](https://typeorm.io/) so that it can be used with many different databases without any further configuration, you simply add the node module for the database driver you want to use in your project and pass a database connection string to NextAuth.js.
-
-### Database Schemas
-
-Configure your database by creating the tables and columns to match the schema expected by NextAuth.js.
-
-- [MySQL Schema](./mysql)
-- [Postgres Schema](./postgres)
-- [Microsoft SQL Server Schema](./mssql)
-- [MongoDB](./mongodb)
-
-The default Adapter is the TypeORM Adapter and the default database type for TypeORM is SQLite, the following configuration options are exactly equivalent.
-
-```javascript
-database: {
- type: 'sqlite',
- database: ':memory:',
- synchronize: true
-}
-```
-
-```javascript
-adapter: Adapters.Default({
- type: "sqlite",
- database: ":memory:",
- synchronize: true,
-})
-```
-
-```javascript
-adapter: Adapters.TypeORM.Adapter({
- type: "sqlite",
- database: ":memory:",
- synchronize: true,
-})
-```
-
-The tutorial [Custom models with TypeORM](/tutorials/typeorm-custom-models) explains how to extend the built in models and schemas used by the TypeORM Adapter. You can use these models in your own code.
-
-:::tip
-The `synchronize` option in TypeORM will generate SQL that exactly matches the documented schemas for MySQL and Postgres. This will automatically apply any changes it finds in the entity model, therefore it **should not be enabled against production databases** as it may cause data loss if the configured schema does not match the expected schema!
-:::
diff --git a/www/versioned_docs/version-v3/adapters/typeorm/postgres.md b/www/versioned_docs/version-v3/adapters/typeorm/postgres.md
deleted file mode 100644
index 8d87af245e..0000000000
--- a/www/versioned_docs/version-v3/adapters/typeorm/postgres.md
+++ /dev/null
@@ -1,90 +0,0 @@
----
-id: postgres
-title: Postgres
----
-
-Schema for a Postgres database.
-
-:::note
-When using a Postgres database with the default adapter (TypeORM) all properties of type `timestamp` are transformed to `timestamp with time zone`/`timestamptz` and all timestamps are stored in UTC.
-
-This transform is also applied to any properties of type `timestamp` when using custom models.
-:::
-
-```sql
-CREATE TABLE accounts
- (
- id SERIAL,
- compound_id VARCHAR(255) NOT NULL,
- user_id INTEGER NOT NULL,
- provider_type VARCHAR(255) NOT NULL,
- provider_id VARCHAR(255) NOT NULL,
- provider_account_id VARCHAR(255) NOT NULL,
- refresh_token TEXT,
- access_token TEXT,
- access_token_expires TIMESTAMPTZ,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
- );
-
-CREATE TABLE sessions
- (
- id SERIAL,
- user_id INTEGER NOT NULL,
- expires TIMESTAMPTZ NOT NULL,
- session_token VARCHAR(255) NOT NULL,
- access_token VARCHAR(255) NOT NULL,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
- );
-
-CREATE TABLE users
- (
- id SERIAL,
- name VARCHAR(255),
- email VARCHAR(255),
- email_verified TIMESTAMPTZ,
- image TEXT,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
- );
-
-CREATE TABLE verification_requests
- (
- id SERIAL,
- identifier VARCHAR(255) NOT NULL,
- token VARCHAR(255) NOT NULL,
- expires TIMESTAMPTZ NOT NULL,
- created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id)
- );
-
-CREATE UNIQUE INDEX compound_id
- ON accounts(compound_id);
-
-CREATE INDEX provider_account_id
- ON accounts(provider_account_id);
-
-CREATE INDEX provider_id
- ON accounts(provider_id);
-
-CREATE INDEX user_id
- ON accounts(user_id);
-
-CREATE UNIQUE INDEX session_token
- ON sessions(session_token);
-
-CREATE UNIQUE INDEX access_token
- ON sessions(access_token);
-
-CREATE UNIQUE INDEX email
- ON users(email);
-
-CREATE UNIQUE INDEX token
- ON verification_requests(token);
-
-```
diff --git a/www/versioned_docs/version-v3/configuration/callbacks.md b/www/versioned_docs/version-v3/configuration/callbacks.md
deleted file mode 100644
index 36740df052..0000000000
--- a/www/versioned_docs/version-v3/configuration/callbacks.md
+++ /dev/null
@@ -1,205 +0,0 @@
----
-id: callbacks
-title: Callbacks
----
-
-Callbacks are **asynchronous** functions you can use to control what happens when an action is performed.
-
-Callbacks are extremely powerful, especially in scenarios involving JSON Web Tokens as they allow you to implement access controls without a database and to integrate with external databases or APIs.
-
-:::tip
-If you want to pass data such as an Access Token or User ID to the browser when using JSON Web Tokens, you can persist the data in the token when the `jwt` callback is called, then pass the data through to the browser in the `session` callback.
-:::
-
-You can specify a handler for any of the callbacks below.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
- callbacks: {
- async signIn(user, account, profile) {
- return true
- },
- async redirect(url, baseUrl) {
- return baseUrl
- },
- async session(session, user) {
- return session
- },
- async jwt(token, user, account, profile, isNewUser) {
- return token
- }
-...
-}
-```
-
-The documentation below shows how to implement each callback, their default behaviour and an example of what the response for each callback should be. Note that configuration options and authentication providers you are using can impact the values passed to the callbacks.
-
-## Sign in callback
-
-Use the `signIn()` callback to control if a user is allowed to sign in.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- /**
- * @param {object} user User object
- * @param {object} account Provider account
- * @param {object} profile Provider profile
- * @return {boolean|string} Return `true` to allow sign in
- * Return `false` to deny access
- * Return `string` to redirect to (eg.: "/unauthorized")
- */
- async signIn(user, account, profile) {
- const isAllowedToSignIn = true
- if (isAllowedToSignIn) {
- return true
- } else {
- // Return false to display a default error message
- return false
- // Or you can return a URL to redirect to:
- // return '/unauthorized'
- }
- }
-}
-...
-```
-
-- When using the **Email Provider** the `signIn()` callback is triggered both when the user makes a **Verification Request** (before they are sent email with a link that will allow them to sign in) and again _after_ they activate the link in the sign in email.
-
- Email accounts do not have profiles in the same way OAuth accounts do. On the first call during email sign in the `profile` object will include a property `verificationRequest: true` to indicate it is being triggered in the verification request flow. When the callback is invoked _after_ a user has clicked on a sign in link, this property will not be present.
-
- You can check for the `verificationRequest` property to avoid sending emails to addresses or domains on a blocklist (or to only explicitly generate them for email address in an allow list).
-
-- When using the **Credentials Provider** the `user` object is the response returned from the `authorization` callback and the `profile` object is the raw body of the `HTTP POST` submission.
-
-:::note
-When using NextAuth.js with a database, the User object will be either a user object from the database (including the User ID) if the user has signed in before or a simpler prototype user object (i.e. name, email, image) for users who have not signed in before.
-
-When using NextAuth.js without a database, the user object it will always be a prototype user object, with information extracted from the profile.
-:::
-
-:::note
-Redirects returned by this callback cancel the authentication flow. Only redirect to error pages that, for example, tell the user why they're not allowed to sign in.
-
-To redirect to a page after a successful sign in, please use [the `callbackUrl` option](/getting-started/client#specifying-a-callbackurl) or [the redirect callback](/configuration/callbacks#redirect-callback).
-:::
-
-## Redirect callback
-
-The redirect callback is called anytime the user is redirected to a callback URL (e.g. on signin or signout).
-
-By default only URLs on the same URL as the site are allowed, you can use the redirect callback to customise that behaviour.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- /**
- * @param {string} url URL provided as callback URL by the client
- * @param {string} baseUrl Default base URL of site (can be used as fallback)
- * @return {string} URL the client will be redirect to
- */
- async redirect(url, baseUrl) {
- return url.startsWith(baseUrl)
- ? url
- : baseUrl
- }
-}
-...
-```
-
-:::note
-The redirect callback may be invoked more than once in the same flow.
-:::
-
-## JWT callback
-
-This JSON Web Token callback is called whenever a JSON Web Token is created (i.e. at sign
-in) or updated (i.e whenever a session is accessed in the client).
-
-e.g. `/api/auth/signin`, `getSession()`, `useSession()`, `/api/auth/session`
-
-- As with database session expiry times, token expiry time is extended whenever a session is active.
-- The arguments _user_, _account_, _profile_ and _isNewUser_ are only passed the first time this callback is called on a new session, after the user signs in.
-
-The contents _user_, _account_, _profile_ and _isNewUser_ will vary depending on the provider and on if you are using a database or not. If you want to pass data such as User ID, OAuth Access Token, etc. to the browser, you can persist it in the token and use the `session()` callback to return it.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- /**
- * @param {object} token Decrypted JSON Web Token
- * @param {object} user User object (only available on sign in)
- * @param {object} account Provider account (only available on sign in)
- * @param {object} profile Provider profile (only available on sign in)
- * @param {boolean} isNewUser True if new user (only available on sign in)
- * @return {object} JSON Web Token that will be saved
- */
- async jwt(token, user, account, profile, isNewUser) {
- // Add access_token to the token right after signin
- if (account?.accessToken) {
- token.accessToken = account.accessToken
- }
- return token
- }
-}
-...
-```
-
-:::tip
-Use an if branch in jwt with checking for existence of any other params than token. If any of those exist, you call jwt for the first time.
-This is a good place to add for example an `access_token` to your jwt, if you want to.
-:::
-
-:::tip
-Check out the content of all the params in addition `token`, to see what info you have available on signin.
-:::
-
-:::warning
-NextAuth.js does not limit how much data you can store in a JSON Web Token, however a ~**4096 byte limit** per cookie is commonly imposed by browsers.
-
-If you need to persist a large amount of data, you will need to persist it elsewhere (e.g. in a database). A common solution is to store a key in the cookie that can be used to look up the remaining data in the database, for example, in the `session()` callback.
-:::
-
-## Session callback
-
-The session callback is called whenever a session is checked. By default, only a subset of the token is returned for increased security. If you want to make something available you added to the token through the `jwt()` callback, you have to explicitly forward it here to make it available to the client.
-
-e.g. `getSession()`, `useSession()`, `/api/auth/session`
-
-- When using database sessions, the User object is passed as an argument.
-- When using JSON Web Tokens for sessions, the JWT payload is provided instead.
-
-```js title="pages/api/auth/[...nextauth].js"
-...
-callbacks: {
- /**
- * @param {object} session Session object
- * @param {object} token User object (if using database sessions)
- * JSON Web Token (if not using database sessions)
- * @return {object} Session that will be returned to the client
- */
- async session(session, token) {
- // Add property to session, like an access_token from a provider.
- session.accessToken = token.accessToken
- return session
- }
-}
-...
-```
-
-:::tip
-When using JSON Web Tokens the `jwt()` callback is invoked before the `session()` callback, so anything you add to the
-JSON Web Token will be immediately available in the session callback, like for example an `access_token` from a provider.
-:::
-
-:::tip
-To better represent its value, when using a JWT session, the second parameter should be called `token` (This is the same thing you return from the `jwt()` callback). If you use a database, call it `user`.
-:::
-
-:::warning
-The session object is not persisted server side, even when using database sessions - only data such as the session token, the user, and the expiry time is stored in the session table.
-
-If you need to persist session data server side, you can use the `accessToken` returned for the session as a key - and connect to the database in the `session()` callback to access it. Session `accessToken` values do not rotate and are valid as long as the session is valid.
-
-If using JSON Web Tokens instead of database sessions, you should use the User ID or a unique key stored in the token (you will need to generate a key for this yourself on sign in, as access tokens for sessions are not generated when using JSON Web Tokens).
-:::
diff --git a/www/versioned_docs/version-v3/configuration/databases.md b/www/versioned_docs/version-v3/configuration/databases.md
deleted file mode 100644
index 3525f41a05..0000000000
--- a/www/versioned_docs/version-v3/configuration/databases.md
+++ /dev/null
@@ -1,221 +0,0 @@
----
-id: databases
-title: Databases
----
-
-NextAuth.js comes with multiple ways of connecting to a database:
-
-- **TypeORM** (default)
- _The TypeORM adapter supports MySQL, PostgreSQL, MSSQL, SQLite and MongoDB databases._
-- **Prisma**
- _The Prisma 2 adapter supports MySQL, PostgreSQL and SQLite databases._
-- **Fauna**
- _The FaunaDB adapter only supports FaunaDB._
-- **Custom Adapter**
- _A custom Adapter can be used to connect to any database._
-
-> There are currently efforts in the [`nextauthjs/adapters`](https://github.com/nextauthjs/adapters) repository to get community-based DynamoDB, Sanity, PouchDB and Sequelize Adapters merged. If you are interested in any of the above, feel free to check out the PRs in the `nextauthjs/adapters` repository!
-
-**This document covers the default adapter (TypeORM).**
-
-See the [documentation for adapters](/adapters/overview) to learn more about using Prisma adapter or using a custom adapter.
-
-To learn more about databases in NextAuth.js and how they are used, check out [databases in the FAQ](/faq#databases).
-
----
-
-## How to use a database
-
-You can specify database credentials as as a connection string or a [TypeORM configuration](https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md) object.
-
-The following approaches are exactly equivalent:
-
-```js
-database: "mysql://nextauth:password@127.0.0.1:3306/database_name"
-```
-
-```js
-database: {
- type: 'mysql',
- host: '127.0.0.1',
- port: 3306,
- username: 'nextauth',
- password: 'password',
- database: 'database_name'
-}
-```
-
-:::tip
-You can pass in any valid [TypeORM configuration option](https://github.com/typeorm/typeorm/blob/master/docs/using-ormconfig.md).
-
-_e.g. To set a prefix for all table names you can use the **entityPrefix** option as connection string parameter:_
-
-```js
-"mysql://nextauth:password@127.0.0.1:3306/database_name?entityPrefix=nextauth_"
-```
-
-_…or as a database configuration object:_
-
-```js
-database: {
- type: 'mysql',
- host: '127.0.0.1',
- port: 3306,
- username: 'nextauth',
- password: 'password',
- database: 'database_name',
- entityPrefix: 'nextauth_'
-}
-```
-
-:::
-
----
-
-## Setting up a database
-
-Using SQL to create tables and columns is the recommended way to set up an SQL database for NextAuth.js.
-
-Check out the links below for SQL you can run to set up a database for NextAuth.js.
-
-- [MySQL Schema](/adapters/typeorm/mysql)
-- [Postgres Schema](/adapters/typeorm/postgres)
-
-_If you are running SQLite, MongoDB or a Document database you can skip this step._
-
-Alternatively, you can also have your database configured automatically using the `synchronize: true` option:
-
-```js
-database: "mysql://nextauth:password@127.0.0.1:3306/database_name?synchronize=true"
-```
-
-```js
-database: {
- type: 'mysql',
- host: '127.0.0.1',
- port: 3306,
- username: 'nextauth',
- password: 'password',
- database: 'database_name',
- synchronize: true
-}
-```
-
-:::warning
-**The `synchronize` option should not be used against production databases.**
-
-It is useful to create the tables you need when setting up a database for the first time, but it should not be enabled against production databases as it may result in data loss if there is a difference between the schema that found in the database and the schema that the version of NextAuth.js being used is expecting.
-:::
-
----
-
-## Supported databases
-
-The default database adapter is TypeORM, but only some databases supported by TypeORM are supported by NextAuth.js as custom logic needs to be handled by NextAuth.js.
-
-Databases compatible with MySQL, Postgres and MongoDB should work out of the box with NextAuth.js. When used with any other database, NextAuth.js will assume an ANSI SQL compatible database.
-
-:::tip
-When configuring your database you also need to install an appropriate **node module** for your database.
-:::
-
-### MySQL
-
-Install module:
-`npm i mysql`
-
-#### Example
-
-```js
-database: "mysql://username:password@127.0.0.1:3306/database_name"
-```
-
-### MariaDB
-
-Install module:
-`npm i mariadb`
-
-#### Example
-
-```js
-database: "mariadb://username:password@127.0.0.1:3306/database_name"
-```
-
-### Postgres / CockroachDB
-
-Install module:
-`npm i pg`
-
-#### Example
-
-PostgresDB
-
-```js
-database: "postgres://username:password@127.0.0.1:5432/database_name"
-```
-
-CockroachDB
-
-```js
-database: "postgres://username:password@127.0.0.1:26257/database_name"
-```
-
-If the node is using Self-signed cert
-
-```js
-database: {
- type: "cockroachdb",
- host: process.env.DATABASE_HOST,
- port: 26257,
- username: process.env.DATABASE_USER,
- password: process.env.DATABASE_PASSWORD,
- database: process.env.DATABASE_NAME,
- ssl: {
- rejectUnauthorized: false,
- ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString()
- },
- },
-```
-
-Read more: [https://node-postgres.com/features/ssl](https://node-postgres.com/features/ssl)
-
----
-
-### Microsoft SQL Server
-
-Install module:
-`npm i mssql`
-
-#### Example
-
-```js
-database: "mssql://sa:password@localhost:1433/database_name"
-```
-
-### MongoDB
-
-Install module:
-`npm i mongodb`
-
-#### Example
-
-```js
-database: "mongodb://username:password@127.0.0.1:3306/database_name"
-```
-
-### SQLite
-
-_SQLite is intended only for development / testing and not for production use._
-
-Install module:
-`npm i sqlite3`
-
-#### Example
-
-```js
-database: "sqlite://localhost/:memory:"
-```
-
-## Other databases
-
-See the [documentation for adapters](/adapters/overview) for more information on advanced configuration, including how to use NextAuth.js with other databases using a [custom adapter](/tutorials/creating-a-database-adapter).
diff --git a/www/versioned_docs/version-v3/configuration/events.md b/www/versioned_docs/version-v3/configuration/events.md
deleted file mode 100644
index 791e7e23a9..0000000000
--- a/www/versioned_docs/version-v3/configuration/events.md
+++ /dev/null
@@ -1,66 +0,0 @@
----
-id: events
-title: Events
----
-
-Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting.
-
-You can specify a handler for any of these events below, for debugging or for an audit log.
-
-:::note
-Execution of your auth API will be blocked by an `await` on your event handler. If your event handler starts any burdensome work it should not block its own promise on that work.
-:::
-
-## Events
-
-### signIn
-
-Sent on successful sign in.
-
-The message will be an object and contain:
-
-- `user` (from your adapter or from the provider if a `credentials` type provider)
-- `account` (from your adapter or the provider)
-- `isNewUser` (whether your adapter had a user for this account already)
-
-### signOut
-
-Sent when the user signs out.
-
-The message object is the JWT, if using them, or the adapter session object for the session that is being ended.
-
-### createUser
-
-Sent when the adapter is told to create a new user.
-
-The message object will be the user.
-
-### updateUser
-
-Sent when the adapter is told to update an existing user. Currently this is only sent when the user verifies their email address.
-
-The message object will be the user.
-
-### linkAccount
-
-Sent when an account in a given provider is linked to a user in our userbase. For example, when a user signs up with Twitter or when an existing user links their Google account.
-
-The message will be an object and contain:
-
-- `user`: The user object from your adapter
-- `providerAccount`: The object returned from the provider.
-
-### session
-
-Sent at the end of a request for the current session.
-
-The message will be an object and contain:
-
-- `session`: The session object from your adapter
-- `jwt`: If using JWT, the token for this session.
-
-### error
-
-Sent when an error occurs
-
-The message could be any object relevant to describing the error.
diff --git a/www/versioned_docs/version-v3/configuration/options.md b/www/versioned_docs/version-v3/configuration/options.md
deleted file mode 100644
index 4c2c0080cd..0000000000
--- a/www/versioned_docs/version-v3/configuration/options.md
+++ /dev/null
@@ -1,471 +0,0 @@
----
-id: options
-title: Options
----
-
-## Environment Variables
-
-### NEXTAUTH_URL
-
-When deploying to production, set the `NEXTAUTH_URL` environment variable to the canonical URL of your site.
-
-```
-NEXTAUTH_URL=https://example.com
-```
-
-If your Next.js application uses a custom base path, specify the route to the API endpoint in full.
-
-_e.g. `NEXTAUTH_URL=https://example.com/custom-route/api/auth`_
-
-:::tip
-To set environment variables on Vercel, you can use the [dashboard](https://vercel.com/dashboard) or the `vercel env` command.
-:::
-
-### NEXTAUTH_URL_INTERNAL
-
-If provided, server-side calls will use this instead of `NEXTAUTH_URL`. Useful in environments when the server doesn't have access to the canonical URL of your site. Defaults to `NEXTAUTH_URL`.
-
-```
-NEXTAUTH_URL_INTERNAL=http://10.240.8.16
-```
-
----
-
-## Options
-
-Options are passed to NextAuth.js when initializing it in an API route.
-
-### providers
-
-- **Default value**: `[]`
-- **Required**: _Yes_
-
-#### Description
-
-An array of authentication providers for signing in (e.g. Google, Facebook, Twitter, GitHub, Email, etc) in any order. This can be one of the built-in providers or an object with a custom provider.
-
-See the [providers documentation](/configuration/providers) for a list of supported providers and how to use them.
-
----
-
-### database
-
-- **Default value**: `null`
-- **Required**: _No (unless using email provider)_
-
-#### Description
-
-[A database connection string or configuration object.](/configuration/databases)
-
----
-
-### secret
-
-- **Default value**: `string` (_SHA hash of the "options" object_)
-- **Required**: _No - but strongly recommended!_
-
-#### Description
-
-A random string used to hash tokens, sign cookies and generate cryptographic keys.
-
-If not specified, it uses a hash for all configuration options, including Client ID / Secrets for entropy.
-
-The default behaviour is volatile, and it is strongly recommended you explicitly specify a value to avoid invalidating end user sessions when configuration changes are deployed.
-
----
-
-### session
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-The `session` object and all properties on it are optional.
-
-Default values for this option are shown below:
-
-```js
-session: {
- // Use JSON Web Tokens for session instead of database sessions.
- // This option can be used with or without a database for users/accounts.
- // Note: `jwt` is automatically set to `true` if no database is specified.
- jwt: false,
-
- // Seconds - How long until an idle session expires and is no longer valid.
- maxAge: 30 * 24 * 60 * 60, // 30 days
-
- // Seconds - Throttle how frequently to write to database to extend a session.
- // Use it to limit write operations. Set to 0 to always update the database.
- // Note: This option is ignored if using JSON Web Tokens
- updateAge: 24 * 60 * 60, // 24 hours
-}
-```
-
----
-
-### jwt
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-JSON Web Tokens can be used for session tokens if enabled with `session: { jwt: true }` option. JSON Web Tokens are enabled by default if you have not specified a database.
-
-By default JSON Web Tokens are signed (JWS) but not encrypted (JWE), as JWT encryption adds additional overhead and comes with some caveats. You can enable encryption by setting `encryption: true`.
-
-#### JSON Web Token Options
-
-```js
-jwt: {
- // A secret to use for key generation - you should set this explicitly
- // Defaults to NextAuth.js secret if not explicitly specified.
- // This is used to generate the actual signingKey and produces a warning
- // message if not defined explicitly.
- // secret: 'INp8IvdIyeMcoGAgFGoA61DdBglwwSqnXJZkgz8PSnw',
- // You can generate a signing key using `jose newkey -s 512 -t oct -a HS512`
- // This gives you direct knowledge of the key used to sign the token so you can use it
- // to authenticate indirectly (eg. to a database driver)
- // signingKey: {"kty":"oct","kid":"Dl893BEV-iVE-x9EC52TDmlJUgGm9oZ99_ZL025Hc5Q","alg":"HS512","k":"K7QqRmJOKRK2qcCKV_pi9PSBv3XP0fpTu30TP8xn4w01xR3ZMZM38yL2DnTVPVw6e4yhdh0jtoah-i4c_pZagA"},
- // If you chose something other than the default algorithm for the signingKey (HS512)
- // you also need to configure the algorithm
- // verificationOptions: {
- // algorithms: ['HS256']
- // },
- // Set to true to use encryption. Defaults to false (signing only).
- // encryption: true,
- // encryptionKey: "",
- // decryptionKey = encryptionKey,
- // decryptionOptions = {
- // algorithms: ['A256GCM']
- // },
- // You can define your own encode/decode functions for signing and encryption
- // if you want to override the default behaviour.
- // async encode({ secret, token, maxAge }) {},
- // async decode({ secret, token, maxAge }) {},
-}
-```
-
-An example JSON Web Token contains a payload like this:
-
-```js
-{
- name: 'Iain Collins',
- email: 'me@iaincollins.com',
- picture: 'https://example.com/image.jpg',
- iat: 1594601838,
- exp: 1597193838
-}
-```
-
-#### JWT Helper
-
-You can use the built-in `getToken()` helper method to verify and decrypt the token, like this:
-
-```js
-import jwt from "next-auth/jwt"
-
-const secret = process.env.JWT_SECRET
-
-export default async (req, res) => {
- const token = await jwt.getToken({ req, secret })
- console.log("JSON Web Token", token)
- res.end()
-}
-```
-
-_For convenience, this helper function is also able to read and decode tokens passed in an HTTP Bearer header._
-
-**Required**
-
-The getToken() helper requires the following options:
-
-- `req` - (object) Request object
-- `secret` - (string) JWT Secret
-
-You must also pass _any options configured on the `jwt` option_ to the helper.
-
-e.g. Including custom session `maxAge` and custom signing and/or encryption keys or options
-
-**Optional**
-
-It also supports the following options:
-
-- `secureCookie` - (boolean) Use secure prefixed cookie name
-
- By default, the helper function will attempt to determine if it should use the secure prefixed cookie (e.g. `true` in production and `false` in development, unless NEXTAUTH_URL contains an HTTPS URL).
-
-- `cookieName` - (string) Session token cookie name
-
- The `secureCookie` option is ignored if `cookieName` is explicitly specified.
-
-- `raw` - (boolean) Get raw token (not decoded)
-
- If set to `true` returns the raw token without decrypting or verifying it.
-
-:::note
-The JWT is stored in the Session Token cookie, the same cookie used for tokens with database sessions.
-:::
-
----
-
-### pages
-
-- **Default value**: `{}`
-- **Required**: _No_
-
-#### Description
-
-Specify URLs to be used if you want to create custom sign in, sign out and error pages.
-
-Pages specified will override the corresponding built-in page.
-
-_For example:_
-
-```js
-pages: {
- signIn: '/auth/signin',
- signOut: '/auth/signout',
- error: '/auth/error', // Error code passed in query string as ?error=
- verifyRequest: '/auth/verify-request', // (used for check email message)
- newUser: null // If set, new users will be directed here on first sign in
-}
-```
-
-See the documentation for the [pages option](/configuration/pages) for more information.
-
----
-
-### callbacks
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-Callbacks are asynchronous functions you can use to control what happens when an action is performed.
-
-Callbacks are extremely powerful, especially in scenarios involving JSON Web Tokens as they allow you to implement access controls without a database and to integrate with external databases or APIs.
-
-You can specify a handler for any of the callbacks below.
-
-```js
-callbacks: {
- async signIn(user, account, profile) {
- return true
- },
- async redirect(url, baseUrl) {
- return baseUrl
- },
- async session(session, user) {
- return session
- },
- async jwt(token, user, account, profile, isNewUser) {
- return token
- }
-}
-```
-
-See the [callbacks documentation](/configuration/callbacks) for more information on how to use the callback functions.
-
----
-
-### events
-
-- **Default value**: `object`
-- **Required**: _No_
-
-#### Description
-
-Events are asynchronous functions that do not return a response, they are useful for audit logging.
-
-You can specify a handler for any of these events below - e.g. for debugging or to create an audit log.
-
-The content of the message object varies depending on the flow (e.g. OAuth or Email authentication flow, JWT or database sessions, etc). See the [events documentation](/configuration/events) for more information on the form of each message object and how to use the events functions.
-
-```js
-events: {
- async signIn(message) { /* on successful sign in */ },
- async signOut(message) { /* on signout */ },
- async createUser(message) { /* user created */ },
- async updateUser(message) { /* user updated - e.g. their email was verified */ },
- async linkAccount(message) { /* account (e.g. Twitter) linked to a user */ },
- async session(message) { /* session is active */ },
- async error(message) { /* error in authentication flow */ }
-}
-```
-
----
-
-### adapter
-
-- **Default value**: _Adapter.Default()_
-- **Required**: _No_
-
-#### Description
-
-By default NextAuth.js uses a database adapter that uses TypeORM and supports MySQL, MariaDB, Postgres and MongoDB and SQLite databases. An alternative adapter that uses Prisma, which currently supports MySQL, MariaDB and Postgres, is also included.
-
-You can use the `adapter` option to use the Prisma adapter - or pass in your own adapter if you want to use a database that is not supported by one of the built-in adapters.
-
-See the [adapter documentation](/adapters/overview) for more information.
-
-:::note
-If the `adapter` option is specified it overrides the `database` option, only specify one or the other.
-:::
-
----
-
-### debug
-
-- **Default value**: `false`
-- **Required**: _No_
-
-#### Description
-
-Set debug to `true` to enable debug messages for authentication and database operations.
-
----
-
-### logger
-
-- **Default value**: `console`
-- **Required**: _No_
-
-#### Description
-
-Override any of the logger levels (`undefined` levels will use the built-in logger), and intercept logs in NextAuth. You can use this to send NextAuth logs to a third-party logging service.
-
-Example:
-
-```js title="/pages/api/auth/[...nextauth].js"
-import log from "logging-service"
-
-export default NextAuth({
- ...
- logger: {
- error(code, ...message) {
- log.error(code, message)
- },
- warn(code, ...message) {
- log.warn(code, message)
- },
- debug(code, ...message) {
- log.debug(code, message)
- }
- }
- ...
-})
-```
-
-:::note
-If the `debug` level is defined by the user, it will be called regardless of the `debug: false` [option](#debug).
-:::
-
----
-
-### theme
-
-- **Default value**: `"auto"`
-- **Required**: _No_
-
-#### Description
-
-Changes the theme of [pages](/configuration/pages). Set to `"light"`, if you want to force pages to always be light. Set to `"dark"`, if you want to force pages to always be dark. Set to `"auto"`, (or leave this option out) if you want the pages to follow the preferred system theme. (Uses the [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media query.)
-
----
-
-## Advanced Options
-
-Advanced options are passed the same way as basic options, but may have complex implications or side effects. You should try to avoid using advanced options unless you are very comfortable using them.
-
----
-
-### useSecureCookies
-
-- **Default value**: `true` for HTTPS sites / `false` for HTTP sites
-- **Required**: _No_
-
-#### Description
-
-When set to `true` (the default for all site URLs that start with `https://`) then all cookies set by NextAuth.js will only be accessible from HTTPS URLs.
-
-This option defaults to `false` on URLs that start with `http://` (e.g. `http://localhost:3000`) for developer convenience.
-
-You can manually set this option to `false` to disable this security feature and allow cookies to be accessible from non-secured URLs (this is not recommended).
-
-:::note
-Properties on any custom `cookies` that are specified override this option.
-:::
-
-:::warning
-Setting this option to _false_ in production is a security risk and may allow sessions to be hijacked if used in production. It is intended to support development and testing. Using this option is not recommended.
-:::
-
----
-
-### cookies
-
-- **Default value**: `{}`
-- **Required**: _No_
-
-#### Description
-
-You can override the default cookie names and options for any of the cookies used by NextAuth.js.
-
-This is an advanced option and using it is not recommended as you may break authentication or introduce security flaws into your application.
-
-You can specify one or more cookies with custom properties, but if you specify custom options for a cookie you must provide all the options for that cookie.
-
-If you use this feature, you will likely want to create conditional behaviour to support setting different cookies policies in development and production builds, as you will be opting out of the built-in dynamic policy.
-
-:::tip
-An example of a use case for this option is to support sharing session tokens across subdomains.
-:::
-
-#### Example
-
-```js
-cookies: {
- sessionToken: {
- name: `__Secure-next-auth.session-token`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- callbackUrl: {
- name: `__Secure-next-auth.callback-url`,
- options: {
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- csrfToken: {
- name: `__Host-next-auth.csrf-token`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: true
- }
- },
- pkceCodeVerifier: {
- name: `${cookiePrefix}next-auth.pkce.code_verifier`,
- options: {
- httpOnly: true,
- sameSite: 'lax',
- path: '/',
- secure: useSecureCookies
- }
- }
-}
-```
-
-:::warning
-Using a custom cookie policy may introduce security flaws into your application and is intended as an option for advanced users who understand the implications. Using this option is not recommended.
-:::
diff --git a/www/versioned_docs/version-v3/configuration/pages.md b/www/versioned_docs/version-v3/configuration/pages.md
deleted file mode 100644
index e62c20a4fc..0000000000
--- a/www/versioned_docs/version-v3/configuration/pages.md
+++ /dev/null
@@ -1,195 +0,0 @@
----
-id: pages
-title: Pages
----
-
-NextAuth.js automatically creates simple, unbranded authentication pages for handling Sign in, Sign out, Email Verification and displaying error messages.
-
-The options displayed on the sign up page are automatically generated based on the providers specified in the options passed to NextAuth.js.
-
-To add a custom login page, you can use the `pages` option:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-...
- pages: {
- signIn: '/auth/signin',
- signOut: '/auth/signout',
- error: '/auth/error', // Error code passed in query string as ?error=
- verifyRequest: '/auth/verify-request', // (used for check email message)
- newUser: null // If set, new users will be directed here on first sign in
- }
-...
-```
-
-## Error codes
-
-We purposefully restrict the returned error codes for increased security.
-
-### Error page
-
-The following errors are passed as error query parameters to the default or overriden error page:
-
-- **Configuration**: There is a problem with the server configuration. Check if your [options](/configuration/options#options) is correct.
-- **AccessDenied**: Usually occurs, when you restricted access through the [`signIn` callback](/configuration/callbacks#sign-in-callback), or [`redirect` callback](/configuration/callbacks#redirect-callback)
-- **Verification**: Related to the Email provider. The token has expired or has already been used
-- **Default**: Catch all, will apply, if none of the above matched
-
-Example: `/auth/error?error=Configuration`
-
-### Sign-in page
-
-The following errors are passed as error query parameters to the default or overriden sign-in page:
-
-- **OAuthSignin**: Error in constructing an authorization URL ([1](https://github.com/nextauthjs/next-auth/blob/457952bb5abf08b09861b0e5da403080cd5525be/src/server/lib/signin/oauth.js), [2](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/pkce-handler.js), [3](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/state-handler.js)),
-- **OAuthCallback**: Error in handling the response ([1](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/callback.js), [2](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/pkce-handler.js), [3](https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/state-handler.js)) from an OAuth provider.
-- **OAuthCreateAccount**: Could not create OAuth provider user in the database.
-- **EmailCreateAccount**: Could not create email provider user in the database.
-- **Callback**: Error in the [OAuth callback handler route](https://github.com/nextauthjs/next-auth/blob/main/src/server/routes/callback.js)
-- **OAuthAccountNotLinked**: If the email on the account is already linked, but not with this OAuth account
-- **EmailSignin**: Sending the e-mail with the verification token failed
-- **CredentialsSignin**: The `authorize` callback returned `null` in the [Credentials provider](/providers/credentials). We don't recommend providing information about which part of the credentials were wrong, as it might be abused by malicious hackers.
-- **Default**: Catch all, will apply, if none of the above matched
-
-Example: `/auth/error?error=Default`
-
-## Theming
-
-By default, the built-in pages will follow the system theme, utilizing the [`prefer-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) Media Query. You can override this to always use a dark or light theme, through the [`theme` option](/configuration/options#theme).
-
-## Examples
-
-### OAuth Sign in
-
-In order to get the available authentication providers and the URLs to use for them, you can make a request to the API endpoint `/api/auth/providers`:
-
-```jsx title="pages/auth/signin.js"
-import { getProviders, signIn } from "next-auth/client"
-
-export default function SignIn({ providers }) {
- return (
- <>
- {Object.values(providers).map((provider) => (
-
-
-
- ))}
- >
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const providers = await getProviders()
- return {
- props: { providers },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async () => {
- return {
- providers: await getProviders()
- }
-}
-*/
-```
-
-### Email Sign in
-
-If you create a custom sign in form for email sign in, you will need to submit both fields for the **email** address and **csrfToken** from **/api/auth/csrf** in a POST request to **/api/auth/signin/email**.
-
-```jsx title="pages/auth/email-signin.js"
-import { getCsrfToken } from "next-auth/client"
-
-export default function SignIn({ csrfToken }) {
- return (
-
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const csrfToken = await getCsrfToken(context)
- return {
- props: { csrfToken },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async (context) => {
- return {
- csrfToken: await getCsrfToken(context)
- }
-}
-*/
-```
-
-You can also use the `signIn()` function which will handle obtaining the CSRF token for you:
-
-```js
-signIn("email", { email: "jsmith@example.com" })
-```
-
-### Credentials Sign in
-
-If you create a sign in form for credentials based authentication, you will need to pass a **csrfToken** from **/api/auth/csrf** in a POST request to **/api/auth/callback/credentials**.
-
-```jsx title="pages/auth/credentials-signin.js"
-import { getCsrfToken } from "next-auth/client"
-
-export default function SignIn({ csrfToken }) {
- return (
-
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- return {
- props: {
- csrfToken: await getCsrfToken(context),
- },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async (context) => {
- return {
- csrfToken: await getCsrfToken(context)
- }
-}
-*/
-```
-
-You can also use the `signIn()` function which will handle obtaining the CSRF token for you:
-
-```js
-signIn("credentials", { username: "jsmith", password: "1234" })
-```
-
-:::tip
-Remember to put any custom pages in a folder outside **/pages/api** which is reserved for API code. As per the examples above, a location convention suggestion is `pages/auth/...`.
-:::
diff --git a/www/versioned_docs/version-v3/configuration/providers.md b/www/versioned_docs/version-v3/configuration/providers.md
deleted file mode 100644
index b02a1e628a..0000000000
--- a/www/versioned_docs/version-v3/configuration/providers.md
+++ /dev/null
@@ -1,297 +0,0 @@
----
-id: providers
-title: Providers
----
-
-Authentication Providers in **NextAuth.js** are services that can be used to sign in a user.
-
-There's four ways a user can be signed in:
-
-- [Using a built-in OAuth Provider](#oauth-providers) (e.g Github, Twitter, Google, etc...)
-- [Using a custom OAuth Provider](#using-a-custom-provider)
-- [Using Email](#email-provider)
-- [Using Credentials](#credentials-provider)
-
-:::note
-NextAuth.js is designed to work with any OAuth service, it supports **OAuth 1.0**, **1.0A** and **2.0** and has built-in support for most popular sign-in services.
-:::
-
-## OAuth Providers
-
-### Available providers
-
-
-
-### How to
-
-1. Register your application at the developer portal of your provider. There are links above to the developer docs for most supported providers with details on how to register your application.
-
-2. The redirect URI should follow this format:
-
-```
-[origin]/api/auth/callback/[provider]
-```
-
-For example, Twitter on `localhost` this would be:
-
-```
-http://localhost:3000/api/auth/callback/twitter
-```
-
-3. Create a `.env` file at the root of your project and add the client ID and client secret. For Twitter this would be:
-
-```
-TWITTER_ID=YOUR_TWITTER_CLIENT_ID
-TWITTER_SECRET=YOUR_TWITTER_CLIENT_SECRET
-```
-
-4. Now you can add the provider settings to the NextAuth options object. You can add as many OAuth providers as you like, as you can see `providers` is an array.
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET
- })
-],
-...
-```
-
-5. Once a provider has been setup, you can sign in at the following URL: `[origin]/api/auth/signin`. This is an unbranded auto-generated page with all the configured providers.
-
-
-
-### Options
-
-| Name | Description | Type | Required |
-| :-----------------: | :--------------------------------------------------------------: | :---------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `oauth` | `"oauth"` | Yes |
-| version | OAuth version (e.g. '1.0', '1.0a', '2.0') | `string` | Yes |
-| scope | OAuth access scopes (expects array or string) | `string` or `string[]` | Yes |
-| params | Extra URL params sent when calling `accessTokenUrl` | `Object` | Yes |
-| accessTokenUrl | Endpoint to retrieve an access token | `string` | Yes |
-| authorizationUrl | Endpoint to request authorization from the user | `string` | Yes |
-| requestTokenUrl | Endpoint to retrieve a request token | `string` | Yes |
-| profileUrl | Endpoint to retrieve the user's profile | `string` | Yes |
-| clientId | Client ID of the OAuth provider | `string` | Yes |
-| clientSecret | Client Secret of the OAuth provider | `string` | Yes |
-| profile | A callback returning an object with the user's info | `(profile, tokens) => Object` | Yes |
-| protection | Additional security for OAuth login flows (defaults to `state`) | `"pkce"`,`"state"`,`"none"` | No |
-| state | Same as `protection: "state"`. Being deprecated, use protection. | `boolean` | No |
-| headers | Any headers that should be sent to the OAuth provider | `Object` | No |
-| authorizationParams | Additional params to be sent to the authorization endpoint | `Object` | No |
-| idToken | Set to `true` for services that use ID Tokens (e.g. OpenID) | `boolean` | No |
-| region | Only when using BattleNet | `string` | No |
-| domain | Only when using certain Providers | `string` | No |
-| tenantId | Only when using Azure, Active Directory, B2C, FusionAuth | `string` | No |
-
-:::tip
-Even if you are using a built-in provider, you can override any of these options to tweak the default configuration.
-
-```js title=[...nextauth].js
-import Providers from "next-auth/providers"
-
-Providers.Auth0({
- clientId: process.env.CLIENT_ID,
- clientSecret: process.env.CLIENT_SECRET,
- domain: process.env.DOMAIN,
- scope: "openid your_custom_scope", // We do provide a default, but this will override it if defined
- profile(profile) {
- return {} // Return the profile in a shape that is different from the built-in one.
- },
-})
-```
-
-:::
-
-### Using a custom provider
-
-You can use an OAuth provider that isn't built-in by using a custom object.
-
-As an example of what this looks like, this is the provider object returned for the Google provider:
-
-```js
-{
- id: "google",
- name: "Google",
- type: "oauth",
- version: "2.0",
- scope: "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
- params: { grant_type: "authorization_code" },
- accessTokenUrl: "https://accounts.google.com/o/oauth2/token",
- requestTokenUrl: "https://accounts.google.com/o/oauth2/auth",
- authorizationUrl: "https://accounts.google.com/o/oauth2/auth?response_type=code",
- profileUrl: "https://www.googleapis.com/oauth2/v1/userinfo?alt=json",
- async profile(profile, tokens) {
- // You can use the tokens, in case you want to fetch more profile information
- // For example several OAuth providers do not return email by default.
- // Depending on your provider, will have tokens like `access_token`, `id_token` and or `refresh_token`
- return {
- id: profile.id,
- name: profile.name,
- email: profile.email,
- image: profile.picture
- }
- },
- clientId: "",
- clientSecret: ""
-}
-```
-
-Replace all the options in this JSON object with the ones from your custom provider - be sure to give it a unique ID and specify the correct OAuth version - and add it to the providers option when initializing the library:
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_ID,
- clientSecret: process.env.TWITTER_SECRET,
- }),
- {
- id: 'customProvider',
- name: 'CustomProvider',
- type: 'oauth',
- version: '2.0',
- scope: '' // Make sure to request the users email address
- ...
- }
-]
-...
-```
-
-### Adding a new provider
-
-If you think your custom provider might be useful to others, we encourage you to open a PR and add it to the built-in list so others can discover it much more easily!
-
-You only need to add two changes:
-
-1. Add your config: [`src/providers/{provider}.js`](https://github.com/nextauthjs/next-auth/tree/main/src/providers)
- • make sure you use a named default export, like this: `export default function YourProvider`
-2. Add provider documentation: [`www/docs/providers/{provider}.md`](https://github.com/nextauthjs/next-auth/tree/main/www/docs/providers)
-3. Add it to our [provider types](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts) (for TS projects)
- • you just need to add your new provider name to [this list](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts#L56-L97)
- • in case you new provider accepts some custom options, you can [add them here](https://github.com/nextauthjs/next-auth/blob/main/types/providers.d.ts#L48-L53)
-
-That's it! 🎉 Others will be able to discover this provider much more easily now!
-
-## Email Provider
-
-### How to
-
-The Email provider uses email to send "magic links" that can be used sign in, you will likely have seen them before if you have used software like Slack.
-
-Adding support for signing in via email in addition to one or more OAuth services provides a way for users to sign in if they lose access to their OAuth account (e.g. if it is locked or deleted).
-
-Configuration is similar to other providers, but the options are different:
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- // maxAge: 24 * 60 * 60, // How long email links are valid for (default 24h)
- }),
-],
-...
-```
-
-See the [Email provider documentation](/providers/email) for more information on how to configure email sign in.
-
-:::note
-The email provider requires a database, it cannot be used without one.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------------------: | :---------------------------------------------------------------------------------: | :------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `email` | `"email"` | Yes |
-| server | Path or object pointing to the email server | `string` or `Object` | Yes |
-| sendVerificationRequest | Callback to execute when a verification request is sent | `(params) => Promise` | Yes |
-| from | The email address from which emails are sent, default: "" | `string` | No |
-| maxAge | How long until the e-mail can be used to log the user in seconds. Defaults to 1 day | `number` | No |
-
-## Credentials Provider
-
-### How to
-
-The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
-
-It is intended to support use cases where you have an existing system you need to authenticate users against.
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Credentials({
- // The name to display on the sign in form (e.g. 'Sign in with...')
- name: 'Credentials',
- // The credentials is used to generate a suitable form on the sign in page.
- // You can specify whatever fields you are expecting to be submitted.
- // e.g. domain, username, password, 2FA token, etc.
- credentials: {
- username: { label: "Username", type: "text", placeholder: "jsmith" },
- password: { label: "Password", type: "password" }
- },
- async authorize(credentials, req) {
- // You need to provide your own logic here that takes the credentials
- // submitted and returns either a object representing a user or value
- // that is false/null if the credentials are invalid.
- // e.g. return { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
- // You can also use the `req` object to obtain additional parameters
- // (i.e., the request IP address)
- const res = await fetch("/your/endpoint", {
- method: 'POST',
- body: JSON.stringify(credentials),
- headers: { "Content-Type": "application/json" }
- })
- const user = await res.json()
-
- // If no error and we have user data, return it
- if (res.ok && user) {
- return user
- }
- // Return null if user data could not be retrieved
- return null
- }
- })
-]
-...
-```
-
-See the [Credentials provider documentation](/providers/credentials) for more information.
-
-:::note
-The Credentials provider can only be used if JSON Web Tokens are enabled for sessions. Users authenticated with the Credentials provider are not persisted in the database.
-:::
-
-### Options
-
-| Name | Description | Type | Required |
-| :---------: | :-----------------------------------------------: | :-----------------------------------: | :------: |
-| id | Unique ID for the provider | `string` | Yes |
-| name | Descriptive name for the provider | `string` | Yes |
-| type | Type of provider, in this case `credentials` | `"credentials"` | Yes |
-| credentials | The credentials to sign-in with | `Object` | Yes |
-| authorize | Callback to execute once user is to be authorized | `(credentials, req) => Promise` | Yes |
diff --git a/www/versioned_docs/version-v3/contributors.md b/www/versioned_docs/version-v3/contributors.md
deleted file mode 100644
index ccfb74d9b8..0000000000
--- a/www/versioned_docs/version-v3/contributors.md
+++ /dev/null
@@ -1,29 +0,0 @@
----
-id: contributors
-title: Contributors
----
-
-## Core Team
-
-- [Iain Collins](https://github.com/iaincollins)
-- [Lori Karikari](https://github.com/LoriKarikari)
-- [Nico Domino](https://github.com/ndom91)
-- [Fredrik Pettersen](https://github.com/Fumler)
-- [Gerald Nolan](https://github.com/geraldnolan)
-- [Lluis Agusti](https://github.com/lluia)
-- [Jefferson Bledsoe](https://github.com/JeffersonBledsoe)
-- [Balázs Orbán](https://github.com/sponsors/balazsorban44)
-
-_Special thanks to Lori Karikari for creating most of the providers, to Nico Domino for creating this site, to Fredrik Pettersen for creating the Prisma adapter, to Gerald Nolan for adding support for Sign in with Apple, to Lluis Agusti for work to add TypeScript definitions and to Jefferson Bledsoe for working on automating testing._
-
-## Other Contributors
-
-NextAuth.js as it exists today has been possible thanks to the work of many individual contributors.
-
-Thank you to the [dozens of individual contributors](https://github.com/nextauthjs/next-auth/graphs/contributors) who have help shaped NextAuth.js.
-
-## History
-
-NextAuth.js was originally developed by Iain Collins in 2016.
-
-In 2020, NextAuth.js was rebuilt from the ground up to support Serverless, with support for MySQL, Postgres and MongoDB, JSON Web Tokens and built in support for over a dozen authentication providers.
diff --git a/www/versioned_docs/version-v3/errors.md b/www/versioned_docs/version-v3/errors.md
deleted file mode 100644
index 27a9f668e8..0000000000
--- a/www/versioned_docs/version-v3/errors.md
+++ /dev/null
@@ -1,161 +0,0 @@
----
-id: errors
-title: Errors
----
-
-This is a list of errors output from NextAuth.js.
-
-All errors indicate an unexpected problem, you should not expect to see errors.
-
-If you are seeing any of these errors in the console, something is wrong.
-
----
-
-## Client
-
-These errors are returned from the client. As the client is [Universal JavaScript (or "Isomorphic JavaScript")](https://en.wikipedia.org/wiki/Isomorphic_JavaScript) it can be run on the client or server, so these errors can occur in both in the terminal and in the browser console.
-
-#### CLIENT_USE_SESSION_ERROR
-
-This error occurs when the `useSession()` React Hook has a problem fetching session data.
-
-#### CLIENT_FETCH_ERROR
-
-If you see `CLIENT_FETCH_ERROR` make sure you have configured the `NEXTAUTH_URL` environment variable.
-
----
-
-## Server
-
-These errors are displayed on the terminal.
-
-### OAuth
-
-#### OAUTH_GET_ACCESS_TOKEN_ERROR
-
-#### OAUTH_V1_GET_ACCESS_TOKEN_ERROR
-
-#### OAUTH_GET_PROFILE_ERROR
-
-#### OAUTH_PARSE_PROFILE_ERROR
-
-#### OAUTH_CALLBACK_HANDLER_ERROR
-
----
-
-### Signin / Callback
-
-#### GET_AUTHORIZATION_URL_ERROR
-
-#### SIGNIN_OAUTH_ERROR
-
-#### CALLBACK_OAUTH_ERROR
-
-#### SIGNIN_EMAIL_ERROR
-
-#### CALLBACK_EMAIL_ERROR
-
-#### EMAIL_REQUIRES_ADAPTER_ERROR
-
-The Email authentication provider can only be used if a database is configured.
-
-#### CALLBACK_CREDENTIALS_JWT_ERROR
-
-The Credentials Provider can only be used if JSON Web Tokens are used for sessions.
-
-JSON Web Tokens are used for Sessions by default if you have not specified a database. However if you are using a database, then Database Sessions are enabled by default and you need to [explicitly enable JWT Sessions](https://next-auth.js.org/configuration/options#session) to use the Credentials Provider.
-
-If you are using a Credentials Provider, NextAuth.js will not persist users or sessions in a database - user accounts used with the Credentials Provider must be created and managed outside of NextAuth.js.
-
-In _most cases_ it does not make sense to specify a database in NextAuth.js options and support a Credentials Provider.
-
-#### CALLBACK_CREDENTIALS_HANDLER_ERROR
-
-#### PKCE_ERROR
-
-The provider you tried to use failed when setting [PKCE or Proof Key for Code Exchange](https://tools.ietf.org/html/rfc7636#section-4.2).
-The `code_verifier` is saved in a cookie called (by default) `__Secure-next-auth.pkce.code_verifier` which expires after 15 minutes.
-Check if `cookies.pkceCodeVerifier` is configured correctly. The default `code_challenge_method` is `"S256"`. This is currently not configurable to `"plain"`, as it is not recommended, and in most cases it is only supported for backward compatibility.
-
----
-
-### Session Handling
-
-#### JWT_SESSION_ERROR
-
-https://next-auth.js.org/errors#jwt_session_error JWKKeySupport: the key does not support HS512 verify algorithm
-
-The algorithm used for generating your key isn't listed as supported. You can generate a HS512 key using
-
-```
- jose newkey -s 512 -t oct -a HS512
-```
-
-If you are unable to use an HS512 key (for example to interoperate with other services) you can define what is supported using
-
-```
- jwt: {
- signingKey: {"kty":"oct","kid":"--","alg":"HS256","k":"--"},
- verificationOptions: {
- algorithms: ["HS256"]
- }
- }
-```
-
-#### SESSION_ERROR
-
----
-
-### Signout
-
-#### SIGNOUT_ERROR
-
----
-
-### Database
-
-These errors are logged by the TypeORM Adapter, which is the default database adapter.
-
-They all indicate a problem interacting with the database.
-
-#### ADAPTER_CONNECTION_ERROR
-
-#### CREATE_USER_ERROR
-
-#### GET_USER_BY_ID_ERROR
-
-#### GET_USER_BY_EMAIL_ERROR
-
-#### GET_USER_BY_PROVIDER_ACCOUNT_ID_ERROR
-
-#### LINK_ACCOUNT_ERROR
-
-#### CREATE_SESSION_ERROR
-
-#### GET_SESSION_ERROR
-
-#### UPDATE_SESSION_ERROR
-
-#### DELETE_SESSION_ERROR
-
-#### CREATE_VERIFICATION_REQUEST_ERROR
-
-#### GET_VERIFICATION_REQUEST_ERROR
-
-#### DELETE_VERIFICATION_REQUEST_ERROR
-
----
-
-### Other
-
-#### SEND_VERIFICATION_EMAIL_ERROR
-
-This error occurs when the Email Authentication Provider is unable to send an email.
-
-Check your mail server configuration.
-
-#### MISSING_NEXTAUTH_API_ROUTE_ERROR
-
-This error happens when `[...nextauth].js` file is not found inside `pages/api/auth`.
-
-Make sure the file is there and the filename is written correctly.
diff --git a/www/versioned_docs/version-v3/faq.md b/www/versioned_docs/version-v3/faq.md
deleted file mode 100644
index ec6ae17378..0000000000
--- a/www/versioned_docs/version-v3/faq.md
+++ /dev/null
@@ -1,237 +0,0 @@
----
-id: faq
-title: Frequently Asked Questions
----
-
-## About NextAuth.js
-
-### Is NextAuth.js commercial software?
-
-NextAuth.js is an open source project built by individual contributors.
-
-It is not commercial software and is not associated with a commercial organization.
-
----
-
-## Compatibility
-
-### What databases does NextAuth.js support?
-
-You can use NextAuth.js with MySQL, MariaDB, Postgres, MongoDB and SQLite or without a database. (See also: [Databases](/configuration/databases))
-
-You can use also NextAuth.js with any database using a custom database adapter, or by using a custom credentials authentication provider - e.g. to support signing in with a username and password stored in an existing database.
-
-### What authentication services does NextAuth.js support?
-
-
NextAuth.js includes built-in support for signing in with
-{Object.values(require("../../providers.json")).sort().join(", ")}.
-(See also: Providers)
-
-
-NextAuth.js also supports email for passwordless sign in, which is useful for account recovery or for people who are not able to use an account with the configured OAuth services (e.g. due to service outage, account suspension or otherwise becoming locked out of an account).
-
-You can also use a custom based provider to support signing in with a username and password stored in an external database and/or using two factor authentication.
-
-### Does NextAuth.js support signing in with a username and password?
-
-NextAuth.js is designed to avoid the need to store passwords for user accounts.
-
-If you have an existing database of usernames and passwords, you can use a custom credentials provider to allow signing in with a username and password stored in an existing database.
-
-_If you use a custom credentials provider user accounts will not be persisted in a database by NextAuth.js (even if one is configured). The option to use JSON Web Tokens for session tokens (which allow sign in without using a session database) must be enabled to use a custom credentials provider._
-
-### Can I use NextAuth.js with a website that does not use Next.js?
-
-NextAuth.js is designed for use with Next.js and Serverless.
-
-If you are using a different framework for you website, you can create a website that handles sign in with Next.js and then access those sessions on a website that does not use Next.js as long as the websites are on the same domain.
-
-If you use NextAuth.js on a website with a different subdomain then the rest of your website (e.g. `auth.example.com` vs `www.example.com`) you will need to set a custom cookie domain policy for the Session Token cookie. (See also: [Cookies](/configuration/options#cookies))
-
-NextAuth.js does not currently support automatically signing into sites on different top level domains (e.g. `www.example.com` vs `www.example.org`) using a single session.
-
-### Can I use NextAuth.js with React Native?
-
-NextAuth.js is designed as a secure, confidential client and implements a server side authentication flow.
-
-It is not intended to be used in native applications on desktop or mobile applications, which typically implement public clients (e.g. with client / secrets embedded in the application).
-
-### Is NextAuth.js supporting TypeScript?
-
-Yes! Check out the [TypeScript docs](/getting-started/typescript)
-
----
-
-## Databases
-
-### What databases are supported by NextAuth.js?
-
-NextAuth.js can be used with MySQL, Postgres, MongoDB, SQLite and compatible databases (e.g. MariaDB, Amazon Aurora, Amazon DocumentDB…) or with no database.
-
-It also provides an Adapter API which allows you to connect it to any database.
-
-### What does NextAuth.js use databases for?
-
-Databases in NextAuth.js are used for persisting users, OAuth accounts, email sign in tokens and sessions.
-
-Specifying a database is optional if you don't need to persist user data or support email sign in. If you don't specify a database then JSON Web Tokens will be enabled for session storage and used to store session data.
-
-If you are using a database with NextAuth.js, you can still explicitly enable JSON Web Tokens for sessions (instead of using database sessions).
-
-### Should I use a database?
-
-- Using NextAuth.js without a database works well for internal tools - where you need to control who is able to sign in, but when you do not need to create user accounts for them in your application.
-
-- Using NextAuth.js with a database is usually a better approach for a consumer facing application where you need to persist accounts (e.g. for billing, to contact customers, etc).
-
-### What database should I use?
-
-Managed database solutions for MySQL, Postgres and MongoDB (and compatible databases) are well supported from cloud providers such as Amazon, Google, Microsoft and Atlas.
-
-If you are deploying directly to a particular cloud platform you may also want to consider serverless database offerings they have (e.g. [Amazon Aurora Serverless on AWS](https://aws.amazon.com/rds/aurora/serverless/)).
-
----
-
-## Security
-
-### I think I've found a security problem, what should I do?
-
-Less serious or edge case issues (e.g. queries about compatibility with optional RFC specifications) can be raised as public issues on GitHub.
-
-If you discover what you think may be a potentially serious security problem, please contact a core team member via a private channel (e.g. via email to me@iaincollins.com) or raise a public issue requesting someone get in touch with you via whatever means you prefer for more details.
-
-### What is the disclosure policy for NextAuth.js?
-
-We practice responsible disclosure.
-
-If you contact us regarding a potentially serious issue, we will endeavor to get back to you within 72 hours and to publish a fix within 30 days. We will responsibly disclose the issue (and credit you with your consent) once a fix to resolve the issue has been released - or after 90 days, which ever is sooner.
-
-### How do I get Refresh Tokens and Access Tokens for an OAuth account?
-
-NextAuth.js provides a solution for authentication, session management and user account creation.
-
-NextAuth.js records Refresh Tokens and Access Tokens on sign in (if supplied by the provider) and it will pass them, along with the User ID, Provider and Provider Account ID, to either:
-
-1. A database - if a database connection string is provided
-2. The JSON Web Token callback - if JWT sessions are enabled (e.g. if no database specified)
-
-You can then look them up from the database or persist them to the JSON Web Token.
-
-Note: NextAuth.js does not currently handle Access Token rotation for OAuth providers for you, however you can check out [this tutorial](/tutorials/refresh-token-rotation) if you want to implement it.
-
-### When I sign in with another account with the same email address, why are accounts not linked automatically?
-
-Automatic account linking on sign in is not secure between arbitrary providers - with the exception of allowing users to sign in via an email addresses as a fallback (as they must verify their email address as part of the flow).
-
-When an email address is associated with an OAuth account it does not necessarily mean that it has been verified as belonging to account holder — how email address verification is handled is not part of the OAuth specification and varies between providers (e.g. some do not verify first, some do verify first, others return metadata indicating the verification status).
-
-With automatic account linking on sign in, this can be exploited by bad actors to hijack accounts by creating an OAuth account associated with the email address of another user.
-
-For this reason it is not secure to automatically link accounts between arbitrary providers on sign in, which is why this feature is generally not provided by authentication service and is not provided by NextAuth.js.
-
-Automatic account linking is seen on some sites, sometimes insecurely. It can be technically possible to do automatic account linking securely if you trust all the providers involved to ensure they have securely verified the email address associated with the account, but requires placing trust (and transferring the risk) to those providers to handle the process securely.
-
-Examples of scenarios where this is secure include with an OAuth provider you control (e.g. that only authorizes users internal to your organization) or with a provider you explicitly trust to have verified the users email address.
-
-Automatic account linking is not a planned feature of NextAuth.js, however there is scope to improve the user experience of account linking and of handling this flow, in a secure way. Typically this involves providing a fallback option to sign in via email, which is already possible (and recommended), but the current implementation of this flow could be improved on.
-
-Providing support for secure account linking and unlinking of additional providers - which can only be done if a user is already signed in already - was originally a feature in v1.x but has not been present since v2.0, is planned to return in a future release.
-
----
-
-## Feature Requests
-
-### Why doesn't NextAuth.js support [a particular feature]?
-
-NextAuth.js is an open source project built by individual contributors who are volunteers writing code and providing support in their spare time.
-
-If you would like NextAuth.js to support a particular feature, the best way to help make it happen is to raise a feature request describing the feature and offer to work with other contributors to develop and test it.
-
-If you are not able to develop a feature yourself, you can offer to sponsor someone to work on it.
-
-### I disagree with a design decision, how can I change your mind?
-
-Product design decisions on NextAuth.js are made by core team members.
-
-You can raise suggestions as feature requests / requests for enhancement.
-
-Requests that provide the detail requested in the template and follow the format requested may be more likely to be supported, as additional detail prompted in the templates often provides important context.
-
-Ultimately if your request is not accepted or is not actively in development, you are always free to fork the project under the terms of the ISC License.
-
----
-
-## JSON Web Tokens
-
-### Does NextAuth.js use JSON Web Tokens?
-
-NextAuth.js supports both database session tokens and JWT session tokens.
-
-- If a database is specified, database session tokens will be used by default.
-- If no database is specified, JWT session tokens will be used by default.
-
-You can also choose to use JSON Web Tokens as session tokens with using a database, by explicitly setting the `session: { jwt: true }` option.
-
-### What are the advantages of JSON Web Tokens?
-
-JSON Web Tokens can be used for session tokens, but are also used for lots of other things, such as sending signed objects between services in authentication flows.
-
-- Advantages of using a JWT as a session token include that they do not require a database to store sessions, this can be faster and cheaper to run and easier to scale.
-
-- JSON Web Tokens in NextAuth.js are secured using cryptographic signing (JWS) by default and it is easy for services and API endpoints to verify tokens without having to contact a database to verify them.
-
-- You can enable encryption (JWE) to store include information directly in a JWT session token that you wish to keep secret and use the token to pass information between services / APIs on the same domain.
-
-- You can use JWT to securely store information you do not mind the client knowing even without encryption, as the JWT is stored in a server-readable-only-token so data in the JWT is not accessible to third party JavaScript running on your site.
-
-### What are the disadvantages of JSON Web Tokens?
-
-- You cannot as easily expire a JSON Web Token - doing so requires maintaining a server side blocklist of invalid tokens (at least until they expire) and checking every token against the list every time a token is presented.
-
- Shorter session expiry times are used when using JSON Web Tokens as session tokens to allow sessions to be invalidated sooner and simplify this problem.
-
- NextAuth.js client includes advanced features to mitigate the downsides of using shorter session expiry times on the user experience, including automatic session token rotation, optionally sending keep alive messages to prevent short lived sessions from expiring if there is an window or tab open, background re-validation, and automatic tab/window syncing that keeps sessions in sync across windows any time session state changes or a window or tab gains or loses focus.
-
-- As with database session tokens, JSON Web Tokens are limited in the amount of data you can store in them. There is typically a limit of around 4096 bytes per cookie, though the exact limit varies between browsers, proxies and hosting services. If you want to support most browsers, then do not exceed 4096 bytes per cookie. If you want to save more data, you will need to persist your sessions in a database (Source: [browsercookielimits.iain.guru](http://browsercookielimits.iain.guru/))
-
- The more data you try to store in a token and the more other cookies you set, the closer you will come to this limit. If you wish to store more than ~4 KB of data you're probably at the point where you need to store a unique ID in the token and persist the data elsewhere (e.g. in a server-side key/value store).
-
-- Data stored in an encrypted JSON Web Token (JWE) may be compromised at some point.
-
- Even if appropriately configured, information stored in an encrypted JWT should not be assumed to be impossible to decrypt at some point - e.g. due to the discovery of a defect or advances in technology.
-
- Avoid storing any data in a token that might be problematic if it were to be decrypted in the future.
-
-- If you do not explicitly specify a secret for for NextAuth.js, existing sessions will be invalidated any time your NextAuth.js configuration changes, as NextAuth.js will default to an auto-generated secret.
-
- If using JSON Web Token you should at least specify a secret and ideally configure public/private keys.
-
-### Are JSON Web Tokens secure?
-
-By default tokens are signed (JWS) but not encrypted (JWE), as encryption adds additional overhead and reduces the amount of space available to store data (total cookie size for a domain is limited to 4KB).
-
-- JSON Web Tokens in NextAuth.js use JWS and are signed using HS512 with an auto-generated key.
-
-- If encryption is enabled by setting `jwt: { encryption: true }` option then the JWT will _also_ use JWE to encrypt the token, using A256GCM with an auto-generated key.
-
-You can specify other valid algorithms - [as specified in RFC 7518](https://tools.ietf.org/html/rfc7517) - with either a secret (for symmetric encryption) or a public/private key pair (for a symmetric encryption).
-
-NextAuth.js will generate keys for you, but this will generate a warning at start up.
-
-Using explicit public/private keys for signing is strongly recommended.
-
-### What signing and encryption standards does NextAuth.js support?
-
-NextAuth.js includes a largely complete implementation of JSON Object Signing and Encryption (JOSE):
-
-- [RFC 7515 - JSON Web Signature (JWS)](https://tools.ietf.org/html/rfc7515)
-- [RFC 7516 - JSON Web Encryption (JWE)](https://tools.ietf.org/html/rfc7516)
-- [RFC 7517 - JSON Web Key (JWK)](https://tools.ietf.org/html/rfc7517)
-- [RFC 7518 - JSON Web Algorithms (JWA)](https://tools.ietf.org/html/rfc7518)
-- [RFC 7519 - JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519)
-
-This incorporates support for:
-
-- [RFC 7638 - JSON Web Key Thumbprint](https://tools.ietf.org/html/rfc7638)
-- [RFC 7787 - JSON JWS Unencoded Payload Option](https://tools.ietf.org/html/rfc7797)
-- [RFC 8037 - CFRG Elliptic Curve ECDH and Signatures](https://tools.ietf.org/html/rfc8037)
diff --git a/www/versioned_docs/version-v3/getting-started/client.md b/www/versioned_docs/version-v3/getting-started/client.md
deleted file mode 100644
index 815d364c7f..0000000000
--- a/www/versioned_docs/version-v3/getting-started/client.md
+++ /dev/null
@@ -1,473 +0,0 @@
----
-id: client
-title: Client API
----
-
-The NextAuth.js client library makes it easy to interact with sessions from React applications.
-
-#### Example Session Object
-
-```js
-{
- user: {
- name: string,
- email: string,
- image: uri
- },
- accessToken: string,
- expires: "YYYY-MM-DDTHH:mm:ss.SSSZ"
-}
-```
-
-:::tip
-The session data returned to the client does not contain sensitive information such as the Session Token or OAuth tokens. It contains a minimal payload that includes enough data needed to display information on a page about the user who is signed in for presentation purposes (e.g name, email, image).
-
-You can use the [session callback](/configuration/callbacks#session-callback) to customize the session object returned to the client if you need to return additional data in the session object.
-:::
-
----
-
-## useSession()
-
-- Client Side: **Yes**
-- Server Side: No
-
-The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
-
-It works best when the [``](#provider) is added to `pages/_app.js`.
-
-#### Example
-
-```jsx
-import { useSession } from "next-auth/client"
-
-export default function Component() {
- const [session, loading] = useSession()
-
- if (session) {
- return
Signed in as {session.user.email}
- }
-
- return Sign in
-}
-```
-
----
-
-## getSession()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-NextAuth.js provides a `getSession()` method which can be called client or server side to return a session.
-
-It calls `/api/auth/session` and returns a promise with a session object, or null if no session exists.
-
-#### Client Side Example
-
-```js
-async function myFunction() {
- const session = await getSession()
- /* ... */
-}
-```
-
-#### Server Side Example
-
-```js
-import { getSession } from "next-auth/client"
-
-export default async (req, res) => {
- const session = await getSession({ req })
- /* ... */
- res.end()
-}
-```
-
-:::note
-When calling `getSession()` server side, you need to pass `{req}` or `context` object.
-:::
-
-The tutorial [securing pages and API routes](/tutorials/securing-pages-and-api-routes) shows how to use `getSession()` in server side calls.
-
----
-
-## getCsrfToken()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-The `getCsrfToken()` method returns the current Cross Site Request Forgery Token (CSRF Token) required to make POST requests (e.g. for signing in and signing out).
-
-You likely only need to use this if you are not using the built-in `signIn()` and `signOut()` methods.
-
-#### Client Side Example
-
-```js
-async function myFunction() {
- const csrfToken = await getCsrfToken()
- /* ... */
-}
-```
-
-#### Server Side Example
-
-```js
-import { getCsrfToken } from "next-auth/client"
-
-export default async (req, res) => {
- const csrfToken = await getCsrfToken({ req })
- /* ... */
- res.end()
-}
-```
-
----
-
-## getProviders()
-
-- Client Side: **Yes**
-- Server Side: **Yes**
-
-The `getProviders()` method returns the list of providers currently configured for sign in.
-
-It calls `/api/auth/providers` and returns a list of the currently configured authentication providers.
-
-It can be useful if you are creating a dynamic custom sign in page.
-
----
-
-#### API Route
-
-```jsx title="pages/api/example.js"
-import { getProviders } from "next-auth/client"
-
-export default async (req, res) => {
- const providers = await getProviders()
- console.log("Providers", providers)
- res.end()
-}
-```
-
-:::note
-Unlike `getSession()` and `getCsrfToken()`, when calling `getProviders()` server side, you don't need to pass anything, just as calling it client side.
-:::
-
----
-
-## signIn()
-
-- Client Side: **Yes**
-- Server Side: No
-
-Using the `signIn()` method ensures the user ends back on the page they started on after completing a sign in flow. It will also handle CSRF Tokens for you automatically when signing in with email.
-
-The `signIn()` method can be called from the client in different ways, as shown below.
-
-#### Redirects to sign in page when clicked
-
-```js
-import { signIn } from "next-auth/client"
-
-export default () =>
-```
-
-#### Starts Google OAuth sign-in flow when clicked
-
-```js
-import { signIn } from "next-auth/client"
-
-export default () => (
-
-)
-```
-
-#### Starts Email sign-in flow when clicked
-
-When using it with the email flow, pass the target `email` as an option.
-
-```js
-import { signIn } from "next-auth/client"
-
-export default ({ email }) => (
-
-)
-```
-
-#### Specifying a callbackUrl
-
-The `callbackUrl` specifies to which URL the user will be redirected after signing in. It defaults to the current URL of a user.
-
-You can specify a different `callbackUrl` by specifying it as the second argument of `signIn()`. This works for all providers.
-
-e.g.
-
-- `signIn(null, { callbackUrl: 'http://localhost:3000/foo' })`
-- `signIn('google', { callbackUrl: 'http://localhost:3000/foo' })`
-- `signIn('email', { email, callbackUrl: 'http://localhost:3000/foo' })`
-
-The URL must be considered valid by the [redirect callback handler](/configuration/callbacks#redirect-callback). By default it requires the URL to be an absolute URL at the same hostname, or else it will redirect to the homepage. You can define your own [redirect callback](/configuration/callbacks#redirect-callback) to allow other URLs, including supporting relative URLs.
-
-#### Using the redirect: false option
-
-:::note
-The redirect option is only available for `credentials` and `email` providers.
-:::
-
-In some cases, you might want to deal with the sign in response on the same page and disable the default redirection. For example, if an error occurs (like wrong credentials given by the user), you might want to handle the error on the same page. For that, you can pass `redirect: false` in the second parameter object.
-
-e.g.
-
-- `signIn('credentials', { redirect: false, password: 'password' })`
-- `signIn('email', { redirect: false, email: 'bill@fillmurray.com' })`
-
-`signIn` will then return a Promise, that resolves to the following:
-
-```ts
-{
- /**
- * Will be different error codes,
- * depending on the type of error.
- */
- error: string | undefined
- /**
- * HTTP status code,
- * hints the kind of error that happened.
- */
- status: number
- /**
- * `true` if the signin was successful
- */
- ok: boolean
- /**
- * `null` if there was an error,
- * otherwise the url the user
- * should have been redirected to.
- */
- url: string | null
-}
-```
-
-#### Additional params
-
-It is also possible to pass additional parameters to the `/authorize` endpoint through the third argument of `signIn()`.
-
-See the [Authorization Request OIDC spec](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) for some ideas. (These are not the only possible ones, all parameters will be forwarded)
-
-e.g.
-
-- `signIn("identity-server4", null, { prompt: "login" })` _always ask the user to reauthenticate_
-- `signIn("auth0", null, { login_hint: "info@example.com" })` _hints the e-mail address to the provider_
-
-:::note
-You can also set these parameters through [`provider.authorizationParams`](/configuration/providers#oauth-provider-options).
-:::
-
-:::note
-The following parameters are always overridden server-side: `redirect_uri`, `state`
-:::
-
----
-
-## signOut()
-
-- Client Side: **Yes**
-- Server Side: No
-
-Using the `signOut()` method ensures the user ends back on the page they started on after completing the sign out flow. It also handles CSRF tokens for you automatically.
-
-It reloads the page in the browser when complete.
-
-```js
-import { signOut } from "next-auth/client"
-
-export default () =>
-```
-
-#### Specifying a callbackUrl
-
-As with the `signIn()` function, you can specify a `callbackUrl` parameter by passing it as an option.
-
-e.g. `signOut({ callbackUrl: 'http://localhost:3000/foo' })`
-
-The URL must be considered valid by the [redirect callback handler](/configuration/callbacks#redirect-callback). By default this means it must be an absolute URL at the same hostname (or else it will default to the homepage); you can define your own custom [redirect callback](/configuration/callbacks#redirect-callback) to allow other URLs, including supporting relative URLs.
-
-#### Using the redirect: false option
-
-If you pass `redirect: false` to `signOut`, the page will not reload. The session will be deleted, and the `useSession` hook is notified, so any indication about the user will be shown as logged out automatically. It can give a very nice experience for the user.
-
-:::tip
-If you need to redirect to another page but you want to avoid a page reload, you can try:
-`const data = await signOut({redirect: false, callbackUrl: "/foo"})`
-where `data.url` is the validated url you can redirect the user to without any flicker by using Next.js's `useRouter().push(data.url)`
-:::
-
----
-
-## Provider
-
-Using the supplied React `` allows instances of `useSession()` to share the session object across components, by using [React Context](https://reactjs.org/docs/context.html) under the hood.
-
-This improves performance, reduces network calls and avoids page flicker when rendering. It is highly recommended and can be easily added to all pages in Next.js apps by using `pages/_app.js`.
-
-```jsx title="pages/_app.js"
-import { Provider } from "next-auth/client"
-
-export default function App({ Component, pageProps }) {
- return (
-
-
-
- )
-}
-```
-
-If you pass the `session` page prop to the `` – as in the example above – you can avoid checking the session twice on pages that support both server and client side rendering.
-
-This only works on pages where you provide the correct `pageProps`, however. This is normally done in `getInitialProps` or `getServerSideProps` like so:
-
-```js title="pages/index.js"
-import { getSession } from "next-auth/client"
-
-...
-
-export async function getServerSideProps(ctx) {
- return {
- props: {
- session: await getSession(ctx)
- }
- }
-}
-```
-
-If every one of your pages needs to be protected, you can do this in `_app`, otherwise you can do it on a page-by-page basis. Alternatively, you can do per page authentication checks client side, instead of having each auth check be blocking (SSR) by using the method described below in [alternative client session handling](#custom-client-session-handling).
-
-### Options
-
-The session state is automatically synchronized across all open tabs/windows and they are all updated whenever they gain or lose focus or the state changes in any of them (e.g. a user signs in or out).
-
-If you have session expiry times of 30 days (the default) or more then you probably don't need to change any of the default options in the Provider. If you need to, you can can trigger an update of the session object across all tabs/windows by calling `getSession()` from a client side function.
-
-However, if you need to customise the session behaviour and/or are using short session expiry times, you can pass options to the provider to customise the behaviour of the `useSession()` hook.
-
-```jsx title="pages/_app.js"
-import { Provider } from 'next-auth/client'
-
-export default function App ({ Component, pageProps }) {
- return (
-
-
-
- )
-}
-```
-
-:::note
-**These options have no effect on clients that are not signed in.**
-
-Every tab/window maintains its own copy of the local session state; the session is not stored in shared storage like localStorage or sessionStorage. Any update in one tab/window triggers a message to other tabs/windows to update their own session state.
-
-Using low values for `clientMaxAge` or `keepAlive` will increase network traffic and load on authenticated clients and may impact hosting costs and performance.
-:::
-
-#### Client Max Age
-
-The `clientMaxAge` option is the maximum age a session data can be on the client before it is considered stale.
-
-When `clientMaxAge` is set to `0` (the default) the cache will always be used when useSession is called and only explicit calls made to get the session status (i.e. `getSession()`) or event triggers, such as signing in or out in another tab/window, or a tab/window gaining or losing focus, will trigger an update of the session state.
-
-If set to any value other than zero, it specifies in seconds the maximum age of session data on the client before the `useSession()` hook will call the server again to sync the session state.
-
-Unless you have a short session expiry time (e.g. < 24 hours) you probably don't need to change this option. Setting this option to too short a value will increase load (and potentially hosting costs).
-
-The value for `clientMaxAge` should always be lower than the value of the session `maxAge` option.
-
-#### Keep Alive
-
-The `keepAlive` option is how often the client should contact the server to avoid a session expiring.
-
-When `keepAlive` is set to `0` (the default) it will not send a keep alive message.
-
-If set to any value other than zero, it specifies in seconds how often the client should contact the server to update the session state. If the session state has expired when it is triggered, all open tabs/windows will be updated to reflect this.
-
-The value for `keepAlive` should always be lower than the value of the session `maxAge` option.
-
-:::note
-See [**the Next.js documentation**](https://nextjs.org/docs/advanced-features/custom-app) for more information on **\_app.js** in Next.js applications.
-:::
-
-## Alternatives
-
-### Custom Client Session Handling
-
-Due to the way Next.js handles `getServerSideProps` / `getInitialProps`, every protected page load has to make a server-side query to check if the session is valid and then generate the requested page. This alternative solution allows for showing a loading state on the initial check and every page transition afterward will be client-side, without having to check with the server and regenerate pages.
-
-```js title="pages/admin.jsx"
-export default function AdminDashboard() {
- const [session] = useSession()
- // session is always non-null inside this page, all the way down the React tree.
- return "Some super secret dashboard"
-}
-
-AdminDashboard.auth = true
-```
-
-```jsx title="pages/_app.jsx"
-export default function App({ Component, pageProps }) {
- return (
-
- {Component.auth ? (
-
-
-
- ) : (
-
- )}
-
- )
-}
-
-function Auth({ children }) {
- const [session, loading] = useSession()
- const isUser = !!session?.user
- React.useEffect(() => {
- if (loading) return // Do nothing while loading
- if (!isUser) signIn() // If not authenticated, force log in
- }, [isUser, loading])
-
- if (isUser) {
- return children
- }
-
- // Session is being fetched, or no user.
- // If no user, useEffect() will redirect.
- return
Loading...
-}
-```
-
-It can be easily be extended/modified to support something like an options object for role based authentication on pages. An example:
-
-```jsx title="pages/admin.jsx"
-AdminDashboard.auth = {
- role: "admin",
- loading: ,
- unauthorized: "/login-with-different-user", // redirect to this url
-}
-```
-
-Because of how \_app is done, it won't unnecessarily contact the /api/auth/session endpoint for pages that do not require auth.
-
-More information can be found in the following [Github Issue](https://github.com/nextauthjs/next-auth/issues/1210).
-
-### NextAuth.js + React-Query
-
-There is also an alternative client-side API library based upon [`react-query`](https://www.npmjs.com/package/react-query) available under [`nextauthjs/react-query`](https://github.com/nextauthjs/react-query).
-
-If you use `react-query` in your project already, you can leverage it with NextAuth.js to handle the client-side session management for you as well. This replaces NextAuth.js's native `useSession` and `Provider` from `next-auth/client`.
-
-See repository [`README`](https://github.com/nextauthjs/react-query) for more details.
diff --git a/www/versioned_docs/version-v3/getting-started/example.md b/www/versioned_docs/version-v3/getting-started/example.md
deleted file mode 100644
index c236cf41ce..0000000000
--- a/www/versioned_docs/version-v3/getting-started/example.md
+++ /dev/null
@@ -1,110 +0,0 @@
----
-id: example
-title: Example Code
----
-
-## Get started with NextAuth.js
-
-The example code below describes how to add authentication to a Next.js app.
-
-:::tip
-The easiest way to get started is to clone the [example app](https://github.com/nextauthjs/next-auth-example) and follow the instructions in README.md. You can try out a live demo at [next-auth-example.vercel.app](https://next-auth-example.vercel.app)
-:::
-
-### Add API route
-
-To add NextAuth.js to a project create a file called `[...nextauth].js` in `pages/api/auth`.
-
-[Read more about how to add authentication providers.](/configuration/providers)
-
-```javascript title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-export default NextAuth({
- // Configure one or more authentication providers
- providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_ID,
- clientSecret: process.env.GITHUB_SECRET,
- }),
- // ...add more providers here
- ],
-
- // A database is optional, but required to persist accounts in a database
- database: process.env.DATABASE_URL,
-})
-```
-
-All requests to `/api/auth/*` (signin, callback, signout, etc) will automatically be handed by NextAuth.js.
-
-:::tip
-See the [options documentation](/configuration/options) for how to configure providers, databases and other options.
-:::
-
-### Add React Hook
-
-The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
-
-```jsx title="pages/index.js"
-import { signIn, signOut, useSession } from "next-auth/client"
-
-export default function Page() {
- const [session, loading] = useSession()
-
- return (
- <>
- {!session && (
- <>
- Not signed in
-
- >
- )}
- {session && (
- <>
- Signed in as {session.user.email}
-
- >
- )}
- >
- )
-}
-```
-
-:::tip
-You can use the `useSession` hook from anywhere in your application (e.g. in a header component).
-:::
-
-### Add session state
-
-To allow session state to be shared between pages - which improves performance, reduces network traffic and avoids component state changes while rendering - you can use the NextAuth.js Provider in `pages/_app.js`.
-
-```jsx title="pages/_app.js"
-import { Provider } from "next-auth/client"
-
-export default function App({ Component, pageProps }) {
- return (
-
-
-
- )
-}
-```
-
-:::tip
-Check out the [client documentation](/getting-started/client) to see how you can improve the user experience and page performance by using the NextAuth.js client.
-:::
-
-### Deploying to production
-
-When deploying your site set the `NEXTAUTH_URL` environment variable to the canonical URL of the website.
-
-```
-NEXTAUTH_URL=https://example.com
-```
-
-:::tip
-In production, this needs to be set as an environment variable on the service you use to deploy your app.
-
-To set environment variables on Vercel, you can use the [dashboard](https://vercel.com/dashboard) or the `vercel env pull` [command](https://vercel.com/docs/build-step#development-environment-variables).
-:::
diff --git a/www/versioned_docs/version-v3/getting-started/introduction.md b/www/versioned_docs/version-v3/getting-started/introduction.md
deleted file mode 100644
index 7087b9fdab..0000000000
--- a/www/versioned_docs/version-v3/getting-started/introduction.md
+++ /dev/null
@@ -1,55 +0,0 @@
----
-id: introduction
-title: Introduction
----
-
-## About NextAuth.js
-
-NextAuth.js is a complete open source authentication solution for [Next.js](http://nextjs.org/) applications.
-
-It is designed from the ground up to support Next.js and Serverless.
-
-[Check out the example code](/getting-started/example) to see how easy it is to use NextAuth.js for authentication.
-
-### Flexible and easy to use
-
-- Designed to work with any OAuth service, it supports OAuth 1.0, 1.0A and 2.0
-- Built-in support for [many popular sign-in services](/configuration/providers)
-- Supports email / passwordless authentication
-- Supports stateless authentication with any backend (Active Directory, LDAP, etc)
-- Supports both JSON Web Tokens and database sessions
-- Designed for Serverless but runs anywhere (AWS Lambda, Docker, Heroku, etc…)
-
-### Own your own data
-
-NextAuth.js can be used with or without a database.
-
-- An open source solution that allows you to keep control of your data
-- Supports Bring Your Own Database (BYOD) and can be used with any database
-- Built-in support for [MySQL, MariaDB, Postgres, SQL Server, MongoDB and SQLite](/configuration/databases)
-- Works great with databases from popular hosting providers
-- Can also be used _without a database_ (e.g. OAuth + JWT)
-
-_Note: Email sign in requires a database to be configured to store single-use verification tokens._
-
-### Secure by default
-
-- Promotes the use of passwordless sign in mechanisms
-- Designed to be secure by default and encourage best practice for safeguarding user data
-- Uses Cross Site Request Forgery Tokens on POST routes (sign in, sign out)
-- Default cookie policy aims for the most restrictive policy appropriate for each cookie
-- When JSON Web Tokens are enabled, they are signed by default (JWS) with HS512
-- Use JWT encryption (JWE) by setting the option `encryption: true` (defaults to A256GCM)
-- Auto-generates symmetric signing and encryption keys for developer convenience
-- Features tab/window syncing and keepalive messages to support short lived sessions
-- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org/)
-
-Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.
-
-## Credits
-
-NextAuth.js is an open source project that is only possible [thanks to contributors](/contributors).
-
-## Getting Started
-
-[Check out the example code](/getting-started/example) to see how easy it is to use NextAuth.js for authentication.
diff --git a/www/versioned_docs/version-v3/getting-started/rest-api.md b/www/versioned_docs/version-v3/getting-started/rest-api.md
deleted file mode 100644
index a2b1cb84ab..0000000000
--- a/www/versioned_docs/version-v3/getting-started/rest-api.md
+++ /dev/null
@@ -1,62 +0,0 @@
----
-id: rest-api
-title: REST API
----
-
-NextAuth.js exposes a REST API which is used by the NextAuth.js client.
-
-#### `GET` /api/auth/signin
-
-Displays the sign in page.
-
-#### `POST` /api/auth/signin/:provider
-
-Starts an OAuth signin flow for the specified provider.
-
-The POST submission requires CSRF token from `/api/auth/csrf`.
-
-#### `GET` /api/auth/callback/:provider
-
-Handles returning requests from OAuth services during sign in.
-
-For OAuth 2.0 providers that support the `state` option, the value of the `state` parameter is checked against the one that was generated when the sign in flow was started - this uses a hash of the CSRF token which MUST match for both the POST and `GET` calls during sign in.
-
-#### `GET` /api/auth/signout
-
-Displays the sign out page.
-
-#### `POST` /api/auth/signout
-
-Handles signing out - this is a `POST` submission to prevent malicious links from triggering signing a user out without their consent.
-
-The `POST` submission requires CSRF token from `/api/auth/csrf`.
-
-#### `GET` /api/auth/session
-
-Returns client-safe session object - or an empty object if there is no session.
-
-The contents of the session object that is returned are configurable with the session callback.
-
-#### `GET` /api/auth/csrf
-
-Returns object containing CSRF token. In NextAuth.js, CSRF protection is present on all authentication routes. It uses the "double submit cookie method", which uses a signed HttpOnly, host-only cookie.
-
-The CSRF token returned by this endpoint must be passed as form variable named `csrfToken` in all `POST` submissions to any API endpoint.
-
-#### `GET` /api/auth/providers
-
-Returns a list of configured OAuth services and details (e.g. sign in and callback URLs) for each service.
-
-It can be used to dynamically generate custom sign up pages and to check what callback URLs are configured for each OAuth provider that is configured.
-
----
-
-:::note
-The default base path is `/api/auth` but it is configurable by specifying a custom path in `NEXTAUTH_URL`
-
-e.g.
-
-`NEXTAUTH_URL=https://example.com/myapp/api/authentication`
-
-`/api/auth/signin` -> `/myapp/api/authentication/signin`
-:::
diff --git a/www/versioned_docs/version-v3/getting-started/typescript.md b/www/versioned_docs/version-v3/getting-started/typescript.md
deleted file mode 100644
index 80447e6750..0000000000
--- a/www/versioned_docs/version-v3/getting-started/typescript.md
+++ /dev/null
@@ -1,151 +0,0 @@
----
-id: typescript
-title: TypeScript
----
-
-NextAuth.js comes with its own type definitions, so you can safely use it in your TypeScript projects. Even if you don't use TypeScript, IDEs like VSCode will pick this up, to provide you with a better developer experience. While you are typing, you will get suggestions about what certain objects/functions look like, and sometimes also links to documentation, examples and other useful resources.
-
-Check out the example repository showcasing how to use `next-auth` on a Next.js application with TypeScript:
-https://github.com/nextauthjs/next-auth-typescript-example
-
-:::warning
-The types at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) under the name of `@types/next-auth` are now deprecated, and not maintained anymore.
-:::
-
----
-
-## Adapters
-
-If you're writing your own custom Adapter, you can take advantage of the types to make sure your implementation conforms to what's expected:
-
-```ts
-import type { Adapter } from "next-auth/adapters"
-
-const MyAdapter: Adapter = () => {
- return {
- async getAdapter() {
- return {
- // your adapter methods here
- }
- },
- }
-}
-```
-
-When writing your own custom Adapter in plain JavaScript, note that you can use **JSDoc** to get helpful editor hints and auto-completion like so:
-
-```js
-/** @type { import("next-auth/adapters").Adapter } */
-const MyAdapter = () => {
- return {
- async getAdapter() {
- return {
- // your adapter methods here
- }
- },
- }
-}
-```
-
-:::note
-This will work in code editors with a strong TypeScript integration like VSCode or WebStorm. It might not work if you're using more lightweight editors like VIM or Atom.
-:::
-
-## Module Augmentation
-
-`next-auth` comes with certain types/interfaces, that are shared across submodules. Good examples are `Session` and `JWT`. Ideally, you should only need to create these types at a single place, and TS should pick them up in every location where they are referenced. Luckily, this is exactly what Module Augmentation can do for us. Define your shared interfaces in a single location, and get type-safety across your application, when you use `next-auth` (or one of its submodules).
-
-### Main module
-
-Let's look at `Session`:
-
-```ts title="pages/api/[...nextauth].ts"
-import NextAuth from "next-auth"
-
-export default NextAuth({
- callbacks: {
- session(session, token) {
- return session // The type here should match the one returned in `useSession()`
- },
- },
-})
-```
-
-```ts title="pages/index.ts"
-import { useSession } from "next-auth/client"
-
-export default function IndexPage() {
- // `session` should match `callbacks.session()` in `NextAuth()`
- const [session] = useSession()
-
- return (
- // Your component
- )
-}
-```
-
-To extend/augment this type, create a `types/next-auth.d.ts` file in your project:
-
-```ts title="types/next-auth.d.ts"
-import NextAuth from "next-auth"
-
-declare module "next-auth" {
- /**
- * Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
- */
- interface Session {
- user: {
- /** The user's postal address. */
- address: string
- }
- }
-}
-```
-
-#### Popular interfaces to augment
-
-Although you can augment almost anything, here are some of the more common interfaces that you might want to override in the `next-auth` module:
-
-```ts
-/**
- * The shape of the user object returned in the OAuth providers' `profile` callback,
- * or the second parameter of the `session` callback, when using a database.
- */
-interface User {}
-/**
- * Usually contains information about the provider being used
- * and also extends `TokenSet`, which is different tokens returned by OAuth Providers.
- */
-interface Account {}
-/** The OAuth profile returned from your provider */
-interface Profile {}
-```
-
-Make sure that the `types` folder is added to [`typeRoots`](https://www.typescriptlang.org/tsconfig/#typeRoots) in your project's `tsconfig.json` file.
-
-### Submodules
-
-The `JWT` interface can be found in the `next-auth/jwt` submodule:
-
-```ts title="types/next-auth.d.ts"
-declare module "next-auth/jwt" {
- /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
- interface JWT {
- /** OpenID ID Token */
- idToken?: string
- }
-}
-```
-
-### Useful links
-
-1. [TypeScript documentation: Module Augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
-2. [Digital Ocean: Module Augmentation in TypeScript](https://www.digitalocean.com/community/tutorials/typescript-module-augmentation)
-
-## Contributing
-
-Contributions of any kind are always welcome, especially for TypeScript. Please keep in mind that we are a small team working on this project in our free time. We will try our best to give support, but if you think you have a solution for a problem, please open a PR!
-
-:::note
-When contributing to TypeScript, if the actual JavaScript user API does not change in a breaking manner, we reserve the right to push any TypeScript change in a minor release. This is to ensure that we can keep us on a faster release cycle.
-:::
diff --git a/www/versioned_docs/version-v3/providers/42.md b/www/versioned_docs/version-v3/providers/42.md
deleted file mode 100644
index 3f5b5accc2..0000000000
--- a/www/versioned_docs/version-v3/providers/42.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: 42-school
-title: 42 School
----
-
-## Documentation
-
-https://api.intra.42.fr/apidoc/guides/web_application_flow
-
-## Configuration
-
-https://profile.intra.42.fr/oauth/applications/new
-
-## Options
-
-The **42 School Provider** comes with a set of default options:
-
-- [42 School Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/42.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FortyTwo({
- clientId: process.env.FORTY_TWO_CLIENT_ID,
- clientSecret: process.env.FORTY_TWO_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/apple.md b/www/versioned_docs/version-v3/providers/apple.md
deleted file mode 100644
index a88de53c90..0000000000
--- a/www/versioned_docs/version-v3/providers/apple.md
+++ /dev/null
@@ -1,209 +0,0 @@
----
-id: apple
-title: Apple
----
-
-## Documentation
-
-https://developer.apple.com/sign-in-with-apple/get-started/
-
-## Configuration
-
-https://developer.apple.com/account/resources/identifiers/list/serviceId
-
-## Options
-
-The **Apple Provider** comes with a set of default options:
-
-- [Apple Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/apple.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-There are two ways you can use the Sign in with Apple provider.
-
-### Dynamically generated secret
-
-If you use a dynamically generated secret you never have to manually update the server.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Apple({
- clientId: process.env.APPLE_ID,
- clientSecret: {
- teamId: process.env.APPLE_TEAM_ID,
- privateKey: process.env.APPLE_PRIVATE_KEY,
- keyId: process.env.APPLE_KEY_ID,
- }
- })
-]
-...
-```
-
-:::tip
-
-You can convert your Apple key to a single line to use it in an environment variable.
-
-**Mac**
-
-```bash
-awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' AuthKey_ID.k8
-```
-
-**Windows**
-
-```powershell
- $k8file = "AuthKey_ID.k8"
-(Get-Content "C:\Users\$env:UserName\Downloads\${k8file}") -join "\n"
-```
-
-:::
-
-### Pre-generated secret
-
-If you use a pre-generated secret you can avoid adding your private key as an environment variable.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Apple({
- clientId: process.env.APPLE_ID,
- clientSecret: process.env.APPLE_KEY_SECRET
- })
-]
-...
-```
-
-:::tip
-The TeamID is located on the top right after logging in.
-:::
-
-:::tip
-The KeyID is located after you create the Key look for before you download the k8 file.
-:::
-
-## Instructions
-
-### Testing
-
-:::tip
-Apple requires all sites to run HTTPS (including local development instances).
-:::
-
-:::tip
-Apple doesn't allow you to use localhost in domains or subdomains.
-:::
-
-The following guides may be helpful:
-
-- [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
-
-- [Guide to configuring Sign in with Apple](https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple)
-
-### Example server
-
-You will need to edit your host file and point your site at `127.0.0.1`
-
-[How to edit my host file?](https://phoenixnap.com/kb/how-to-edit-hosts-file-in-windows-mac-or-linux)
-
-On Windows (Run Powershell as administrator)
-
-```ps
-Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tdev.example.com" -Force
-```
-
-```
-127.0.0.1 dev.example.com
-```
-
-#### Create certificate
-
-Creating a certificate for localhost is easy with openssl . Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
-
-```bash
-openssl req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost' -extensions EXT -config <( \
- printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
-```
-
-:::tip
-**Windows**
-
-The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
-Once installed you will find the openssl.exe file in `C:/Program Files/Git/mingw64/bin` which you can add to the system PATH environment variable if it’s not already done.
-
-Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf`
-
-```bash
- req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost'
-```
-
-:::
-
-Create directory `certificates` and place `localhost.key` and `localhost.crt`
-
-You can create a `server.js` in the root of your project and run it with `node server.js` to test Sign in with Apple integration locally:
-
-```js
-const { createServer } = require("https")
-const { parse } = require("url")
-const next = require("next")
-const fs = require("fs")
-
-const dev = process.env.NODE_ENV !== "production"
-const app = next({ dev })
-const handle = app.getRequestHandler()
-
-const httpsOptions = {
- key: fs.readFileSync("./certificates/localhost.key"),
- cert: fs.readFileSync("./certificates/localhost.crt"),
-}
-
-app.prepare().then(() => {
- createServer(httpsOptions, (req, res) => {
- const parsedUrl = parse(req.url, true)
- handle(req, res, parsedUrl)
- }).listen(3000, (err) => {
- if (err) throw err
- console.log("> Ready on https://localhost:3000")
- })
-})
-```
-
-### Example JWT code
-
-If you want to pre-generate your secret, this is an example of the code you will need:
-
-```js
-const jwt = require("jsonwebtoken")
-const fs = require("fs")
-
-const appleId = "myapp.example.com"
-const keyId = ""
-const teamId = ""
-const privateKey = fs.readFileSync("path/to/key")
-
-const secret = jwt.sign(
- {
- iss: teamId,
- iat: Math.floor(Date.now() / 1000),
- exp: Math.floor(Date.now() / 1000) + 86400 * 180, // 6 months
- aud: "https://appleid.apple.com",
- sub: appleId,
- },
- privateKey,
- {
- algorithm: "ES256",
- keyid: keyId,
- }
-)
-
-console.log(secret)
-```
diff --git a/www/versioned_docs/version-v3/providers/atlassian.md b/www/versioned_docs/version-v3/providers/atlassian.md
deleted file mode 100644
index f82d991bd0..0000000000
--- a/www/versioned_docs/version-v3/providers/atlassian.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-id: atlassian
-title: Atlassian
----
-
-## Documentation
-
-https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo-
-
-## Options
-
-The **Atlassian Provider** comes with a set of default options:
-
-- [Atlassian Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/atlassian.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Atlassian({
- clientId: process.env.ATLASSIAN_CLIENT_ID,
- clientSecret: process.env.ATLASSIAN_CLIENT_SECRET,
- scope: 'write:jira-work read:jira-work read:jira-user offline_access read:me'
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-:::tip
-An app can be created at https://developer.atlassian.com/apps/
-:::
-
-Under "Apis and features" in the side menu, configure the following for "OAuth 2.0 (3LO)":
-
-- Redirect URL
- - http://localhost:3000/api/auth/callback/atlassian
-
-:::warning
-To enable access to Jira Platform REST API you must enable User Identity API and add `read:me` to your provider scope option.
-:::
diff --git a/www/versioned_docs/version-v3/providers/auth0.md b/www/versioned_docs/version-v3/providers/auth0.md
deleted file mode 100644
index 576414fb99..0000000000
--- a/www/versioned_docs/version-v3/providers/auth0.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: auth0
-title: Auth0
----
-
-## Documentation
-
-https://auth0.com/docs/api/authentication#authorize-application
-
-## Configuration
-
-https://manage.auth0.com/dashboard
-
-:::tip
-Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App').
-:::
-
-## Options
-
-The **Auth0 Provider** comes with a set of default options:
-
-- [Auth0 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/auth0.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Auth0({
- clientId: process.env.AUTH0_CLIENT_ID,
- clientSecret: process.env.AUTH0_CLIENT_SECRET,
- domain: process.env.AUTH0_DOMAIN
- })
-]
-...
-```
-
-:::note
-`domain` should be the fully qualified domain – e.g. `dev-s6clz2lv.eu.auth0.com`
-:::
diff --git a/www/versioned_docs/version-v3/providers/azure-ad-b2c.md b/www/versioned_docs/version-v3/providers/azure-ad-b2c.md
deleted file mode 100644
index 514b90f580..0000000000
--- a/www/versioned_docs/version-v3/providers/azure-ad-b2c.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-id: azure-ad-b2c
-title: Azure Active Directory B2C
----
-
-## Documentation
-
-https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
-
-## Configuration
-
-https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant
-
-## Options
-
-The **Azure Active Directory Provider** comes with a set of default options:
-
-- [Azure Active Directory Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/azure-ad-b2c.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-- In https://portal.azure.com/ -> Azure Active Directory create a new App Registration.
-- Make sure to remember / copy
- - Application (client) ID
- - Directory (tenant) ID
-- When asked for a redirection URL, use http://localhost:3000/api/auth/callback/azure-ad-b2c
-- Create a new secret and remember / copy its value immediately, it will disappear.
-
-In `.env.local` create the following entries:
-
-```
-AZURE_CLIENT_ID=
-AZURE_CLIENT_SECRET=
-AZURE_TENANT_ID=
-```
-
-In `pages/api/auth/[...nextauth].js` find or add the AZURE entries:
-
-```js
-import Providers from 'next-auth/providers';
-...
-providers: [
- Providers.AzureADB2C({
- clientId: process.env.AZURE_CLIENT_ID,
- clientSecret: process.env.AZURE_CLIENT_SECRET,
- scope: 'offline_access User.Read',
- tenantId: process.env.AZURE_TENANT_ID,
- }),
-]
-...
-
-```
diff --git a/www/versioned_docs/version-v3/providers/basecamp.md b/www/versioned_docs/version-v3/providers/basecamp.md
deleted file mode 100644
index 633dc6b261..0000000000
--- a/www/versioned_docs/version-v3/providers/basecamp.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-id: basecamp
-title: Basecamp
----
-
-## Documentation
-
-https://github.com/basecamp/api/blob/master/sections/authentication.md
-
-## Configuration
-
-https://launchpad.37signals.com/integrations
-
-## Options
-
-The **Basecamp Provider** comes with a set of default options:
-
-- [Basecamp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/basecamp.js)
-
-You can override any of the options to suit your own use case.
-
-## Examples
-
-### Basic profile information
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Basecamp({
- clientId: process.env.BASECAMP_CLIENT_ID,
- clientSecret: process.env.BASECAMP_CLIENT_SECRET
- })
-]
-...
-```
-
-:::note
-Using the example above, it is only possible to retrieve profile information such as account id, email and name. If you wish to retrieve user data in relation to a specific team, you must provide a different profileUrl and a custom function to handle profile information as shown in the example below.
-:::
-
-### Profile information in relation to specific team
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Basecamp({
- clientId: process.env.BASECAMP_CLIENT_ID,
- clientSecret: process.env.BASECAMP_CLIENT_SECRET,
- profileUrl: `https://3.basecampapi.com/${process.env.BASECAMP_TEAM_ID}/my/profile.json`,
- profile: (profile) => {
- return {
- id: profile.id,
- name: profile.name,
- email: profile.email_address,
- image: profile.avatar_url,
- admin: profile.admin,
- owner: profile.owner
- }
- }
- })
-]
-...
-```
-
-:::tip
-The BASECAMP_TEAM_ID is found in the url path of your team's homepage. For example, if the url is `https://3.basecamp.com/1234567/projects`, then in this case the BASECAMP_TEAM_ID is 1234567
-:::
diff --git a/www/versioned_docs/version-v3/providers/battlenet.md b/www/versioned_docs/version-v3/providers/battlenet.md
deleted file mode 100644
index 569efad2cd..0000000000
--- a/www/versioned_docs/version-v3/providers/battlenet.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-id: battle.net
-title: Battle.net
----
-
-## Documentation
-
-https://develop.battle.net/documentation/guides/using-oauth
-
-## Configuration
-
-https://develop.battle.net/access/clients
-
-## Options
-
-The **Battle.net Provider** comes with a set of default options:
-
-- [Battle.net Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/battlenet.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.BattleNet({
- clientId: process.env.BATTLENET_CLIENT_ID,
- clientSecret: process.env.BATTLENET_CLIENT_SECRET,
- region: process.env.BATTLENET_REGION
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/box.md b/www/versioned_docs/version-v3/providers/box.md
deleted file mode 100644
index 42935dc99d..0000000000
--- a/www/versioned_docs/version-v3/providers/box.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: box
-title: Box
----
-
-## Documentation
-
-https://developer.box.com/reference/
-
-## Configuration
-
-https://developer.box.com/guides/sso-identities-and-app-users/connect-okta-to-app-users/configure-box/
-
-## Options
-
-The **Box Provider** comes with a set of default options:
-
-- [Box Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/box.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Box({
- clientId: process.env.BOX_CLIENT_ID,
- clientSecret: process.env.BOX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/bungie.md b/www/versioned_docs/version-v3/providers/bungie.md
deleted file mode 100644
index 1835c075c7..0000000000
--- a/www/versioned_docs/version-v3/providers/bungie.md
+++ /dev/null
@@ -1,137 +0,0 @@
----
-id: bungie
-title: Bungie
----
-
-## Documentation
-
-https://github.com/Bungie-net/api/wiki/OAuth-Documentation
-
-## Configuration
-
-https://www.bungie.net/en/Application
-
-## Options
-
-The **Bungie Provider** comes with a set of default options:
-
-- [Bungie Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/bungie.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Bungie({
- clientId: process.env.BUNGIE_CLIENT_ID,
- clientSecret: process.env.BUNGIE_SECRET,
- headers: {
- 'X-API-Key': provess.env.BUNGIE_API_KEY
- }
- }),
-]
-...
-```
-
-### Configuration
-
-:::tip
-Bungie require all sites to run HTTPS (including local development instances).
-:::
-
-:::tip
-Bungie doesn't allow you to use localhost as the website URL, instead you need to use https://127.0.0.1:3000
-:::
-
-Navigate to https://www.bungie.net/en/Application and fill in the required details:
-
-- Application name
-- Application Status
-- Website
-- OAuth Client Type
- - Confidential
-- Redirect URL
- - https://localhost:3000/api/auth/callback/bungie
-- Scope
- - `Access items like your Bungie.net notifications, memberships, and recent Bungie.Net forum activity.`
-- Origin Header
-
-The following guide may be helpful:
-
-- [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
-
-### Example server
-
-You will need to edit your host file and point your site at `127.0.0.1`
-
-[How to edit my host file?](https://phoenixnap.com/kb/how-to-edit-hosts-file-in-windows-mac-or-linux)
-
-On Windows (Run Powershell as administrator)
-
-```ps
-Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tdev.example.com" -Force
-```
-
-```
-127.0.0.1 dev.example.com
-```
-
-#### Create certificate
-
-Creating a certificate for localhost is easy with openssl. Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
-
-```bash
-openssl req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost' -extensions EXT -config <( \
- printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
-```
-
-:::tip
-**Windows**
-
-The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
-Once installed you will find the openssl.exe file in `C:/Program Files/Git/mingw64/bin` which you can add to the system PATH environment variable if it’s not already done.
-
-Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf`
-
-```bash
- req -x509 -out localhost.crt -keyout localhost.key \
- -newkey rsa:2048 -nodes -sha256 \
- -subj '/CN=localhost'
-```
-
-:::
-
-Create directory `certificates` and place `localhost.key` and `localhost.crt`
-
-You can create a `server.js` in the root of your project and run it with `node server.js` to test Sign in with Bungie integration locally:
-
-```js
-const { createServer } = require("https")
-const { parse } = require("url")
-const next = require("next")
-const fs = require("fs")
-
-const dev = process.env.NODE_ENV !== "production"
-const app = next({ dev })
-const handle = app.getRequestHandler()
-
-const httpsOptions = {
- key: fs.readFileSync("./certificates/localhost.key"),
- cert: fs.readFileSync("./certificates/localhost.crt"),
-}
-
-app.prepare().then(() => {
- createServer(httpsOptions, (req, res) => {
- const parsedUrl = parse(req.url, true)
- handle(req, res, parsedUrl)
- }).listen(3000, (err) => {
- if (err) throw err
- console.log("> Ready on https://localhost:3000")
- })
-})
-```
diff --git a/www/versioned_docs/version-v3/providers/cognito.md b/www/versioned_docs/version-v3/providers/cognito.md
deleted file mode 100644
index 152a2e53c8..0000000000
--- a/www/versioned_docs/version-v3/providers/cognito.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: cognito
-title: Amazon Cognito
----
-
-## Documentation
-
-https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html
-
-## Configuration
-
-https://console.aws.amazon.com/cognito/users/
-
-You need to select your AWS region to go the the Cognito dashboard.
-
-## Options
-
-The **Amazon Cognito Provider** comes with a set of default options:
-
-- [Amazon Cognito Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/cognito.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Cognito({
- clientId: process.env.COGNITO_CLIENT_ID,
- clientSecret: process.env.COGNITO_CLIENT_SECRET,
- domain: process.env.COGNITO_DOMAIN,
- })
-]
-...
-```
-
-:::warning
-Make sure you select all the appropriate client settings or the OAuth flow will not work.
-:::
-
-![cognito](https://user-images.githubusercontent.com/7902980/83951604-cd096e80-a832-11ea-8bd2-c496ec9a16cb.PNG)
diff --git a/www/versioned_docs/version-v3/providers/coinbase.md b/www/versioned_docs/version-v3/providers/coinbase.md
deleted file mode 100644
index be9282fd48..0000000000
--- a/www/versioned_docs/version-v3/providers/coinbase.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: coinbase
-title: Coinbase
----
-
-## Documentation
-
-https://developers.coinbase.com/api/v2
-
-## Configuration
-
-https://www.coinbase.com/settings/api
-
-## Options
-
-The **Coinbase Provider** comes with a set of default options:
-
-- [Coinbase Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/coinbase.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Coinbase({
- clientId: process.env.COINBASE_CLIENT_ID,
- clientSecret: process.env.COINBASE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-This Provider template has a 2 hour access token to it. A refresh token is also returned.
-:::
diff --git a/www/versioned_docs/version-v3/providers/credentials.mdx b/www/versioned_docs/version-v3/providers/credentials.mdx
deleted file mode 100644
index 7b725ea697..0000000000
--- a/www/versioned_docs/version-v3/providers/credentials.mdx
+++ /dev/null
@@ -1,151 +0,0 @@
----
-id: credentials
-title: Credentials
----
-
-## Overview
-
-The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, domain, or two factor authentication or hardware device (e.g. YubiKey U2F / FIDO).
-
-It is intended to support use cases where you have an existing system you need to authenticate users against.
-
-It comes with the constraint that users authenticated in this manner are not persisted in the database, and consequently that the Credentials provider can only be used if JSON Web Tokens are enabled for sessions.
-
-:::note
-The functionality provided for credentials based authentication is intentionally limited to discourage use of passwords due to the inherent security risks associated with them and the additional complexity associated with supporting usernames and passwords.
-:::
-
-## Options
-
-The **Credentials Provider** comes with a set of default options:
-
-- [Credentials Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/credentials.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-The Credentials provider is specified like other providers, except that you need to define a handler for `authorize()` that accepts credentials submitted via HTTP POST as input and returns either:
-
-1. A `user` object, which indicates the credentials are valid.
-
-If you return an object it will be persisted to the JSON Web Token and the user will be signed in, unless a custom `signIn()` callback is configured that subsequently rejects it.
-
-2. Either `false` or `null`, which indicates failure.
-
-If you return `false` or `null` then an error will be displayed advising the user to check their details.
-
-3. You can throw an Error or a URL (a string).
-
-If you throw an Error, the user will be sent to the error page with the error message as a query parameter. If throw a URL (a string), the user will be redirected to the URL.
-
-The Credentials provider's `authorize()` method also provides the request object as the second parameter (see example below).
-
-```js title="pages/api/auth/[...nextauth].js"
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Credentials({
- // The name to display on the sign in form (e.g. 'Sign in with...')
- name: 'Credentials',
- // The credentials is used to generate a suitable form on the sign in page.
- // You can specify whatever fields you are expecting to be submitted.
- // e.g. domain, username, password, 2FA token, etc.
- credentials: {
- username: { label: "Username", type: "text", placeholder: "jsmith" },
- password: { label: "Password", type: "password" }
- },
- async authorize(credentials, req) {
- // Add logic here to look up the user from the credentials supplied
- const user = { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
-
- if (user) {
- // Any object returned will be saved in `user` property of the JWT
- return user
- } else {
- // If you return null or false then the credentials will be rejected
- return null
- // You can also Reject this callback with an Error or with a URL:
- // throw new Error('error message') // Redirect to error page
- // throw '/path/to/redirect' // Redirect to a URL
- }
- }
- })
-]
-...
-```
-
-See the [callbacks documentation](/configuration/callbacks) for more information on how to interact with the token.
-
-## Multiple providers
-
-### Example code
-
-You can specify more than one credentials provider by specifying a unique `id` for each one.
-
-You can also use them in conjunction with other provider options.
-
-As with all providers, the order you specify them is the order they are displayed on the sign in page.
-
-```js
-providers: [
- Providers.Credentials({
- id: "domain-login",
- name: "Domain Account",
- async authorize(credentials, req) {
- const user = {
- /* add function to get user */
- }
- return user
- },
- credentials: {
- domain: {
- label: "Domain",
- type: "text ",
- placeholder: "CORPNET",
- value: "CORPNET",
- },
- username: { label: "Username", type: "text ", placeholder: "jsmith" },
- password: { label: "Password", type: "password" },
- },
- }),
- Providers.Credentials({
- id: "intranet-credentials",
- name: "Two Factor Auth",
- async authorize(credentials, req) {
- const user = {
- /* add function to get user */
- }
- return user
- },
- credentials: {
- email: { label: "Username", type: "text ", placeholder: "jsmith" },
- "2fa-key": { label: "2FA Key" },
- },
- }),
- /* ... additional providers ... /*/
-]
-```
-
-### Example UI
-
-This example below shows a complex configuration is rendered by the built in sign in page.
-
-You can also [use a custom sign in page](/configuration/pages#credentials-sign-in) if you want to provide a custom user experience.
-
-export const Image = ({ children, src, alt = "" }) => {
- return (
-
-
-
- )
-}
-
-
diff --git a/www/versioned_docs/version-v3/providers/discord.md b/www/versioned_docs/version-v3/providers/discord.md
deleted file mode 100644
index bd41d09591..0000000000
--- a/www/versioned_docs/version-v3/providers/discord.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: discord
-title: Discord
----
-
-## Documentation
-
-https://discord.com/developers/docs/topics/oauth2
-
-## Configuration
-
-https://discord.com/developers/applications
-
-## Options
-
-The **Discord Provider** comes with a set of default options:
-
-- [Discord Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/discord.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Discord({
- clientId: process.env.DISCORD_CLIENT_ID,
- clientSecret: process.env.DISCORD_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/dropbox.md b/www/versioned_docs/version-v3/providers/dropbox.md
deleted file mode 100644
index 5f06a0d2d4..0000000000
--- a/www/versioned_docs/version-v3/providers/dropbox.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: dropbox
-title: Dropbox
----
-
-## Documentation
-
-https://developers.dropbox.com/oauth-guide
-
-## Configuration
-
-https://www.dropbox.com/developers/apps
-
-## Options
-
-The **Dropbox Provider** comes with a set of default options:
-
-- [Dropbox Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/dropbox.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Dropbox({
- clientId: process.env.DROPBOX_CLIENT_ID,
- clientSecret: process.env.DROPBOX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/email.md b/www/versioned_docs/version-v3/providers/email.md
deleted file mode 100644
index ff169e1f7a..0000000000
--- a/www/versioned_docs/version-v3/providers/email.md
+++ /dev/null
@@ -1,225 +0,0 @@
----
-id: email
-title: Email
----
-
-## Overview
-
-The Email provider uses email to send "magic links" that can be used to sign in, you will likely have seen these if you have used services like Slack before.
-
-Adding support for signing in via email in addition to one or more OAuth services provides a way for users to sign in if they lose access to their OAuth account (e.g. if it is locked or deleted).
-
-The Email provider can be used in conjunction with (or instead of) one or more OAuth providers.
-
-### How it works
-
-On initial sign in, a **Verification Token** is sent to the email address provided. By default this token is valid for 24 hours. If the Verification Token is used with that time (i.e. by clicking on the link in the email) an account is created for the user and they are signed in.
-
-If someone provides the email address of an _existing account_ when signing in, an email is sent and they are signed into the account associated with that email address when they follow the link in the email.
-
-:::tip
-The Email Provider can be used with both JSON Web Tokens and database sessions, but you **must** configure a database to use it. It is not possible to enable email sign in without using a database.
-:::
-
-## Options
-
-The **Email Provider** comes with a set of default options:
-
-- [Email Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/email.js)
-
-You can override any of the options to suit your own use case.
-
-## Configuration
-
-1. You will need an SMTP account; ideally for one of the [services known to work with nodemailer](http://nodemailer.com/smtp/well-known/).
-2. There are two ways to configure the SMTP server connection.
-
-You can either use a connection string or a nodemailer configuration object.
-
-2.1 **Using a connection string**
-
-Create an .env file to the root of your project and add the connection string and email address.
-
-```js title=".env" {1}
- EMAIL_SERVER=smtp://username:password@smtp.example.com:587
- EMAIL_FROM=noreply@example.com
-```
-
-Now you can add the email provider like this:
-
-```js {3} title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM
- }),
-],
-```
-
-2.2 **Using a configuration object**
-
-In your `.env` file in the root of your project simply add the configuration object options individually:
-
-```js title=".env"
-EMAIL_SERVER_USER=username
-EMAIL_SERVER_PASSWORD=password
-EMAIL_SERVER_HOST=smtp.example.com
- EMAIL_SERVER_PORT=587
- EMAIL_FROM=noreply@example.com
-```
-
-Now you can add the provider settings to the NextAuth options object in the Email Provider.
-
-```js title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: {
- host: process.env.EMAIL_SERVER_HOST,
- port: process.env.EMAIL_SERVER_PORT,
- auth: {
- user: process.env.EMAIL_SERVER_USER,
- pass: process.env.EMAIL_SERVER_PASSWORD
- }
- },
- from: process.env.EMAIL_FROM
- }),
-],
-```
-
-3. You can now sign in with an email address at `/api/auth/signin`.
-
-A user account (i.e. an entry in the Users table) will not be created for the user until the first time they verify their email address. If an email address is already associated with an account, the user will be signed in to that account when they use the link in the email.
-
-## Customising emails
-
-You can fully customise the sign in email that is sent by passing a custom function as the `sendVerificationRequest` option to `Providers.Email()`.
-
-e.g.
-
-```js {3} title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- server: process.env.EMAIL_SERVER,
- from: process.env.EMAIL_FROM,
- sendVerificationRequest: ({
- identifier: email,
- url,
- token,
- baseUrl,
- provider,
- }) => {
- /* your function */
- },
- }),
-]
-```
-
-The following code shows the complete source for the built-in `sendVerificationRequest()` method:
-
-```js
-import nodemailer from "nodemailer"
-
-const sendVerificationRequest = ({
- identifier: email,
- url,
- token,
- baseUrl,
- provider,
-}) => {
- return new Promise((resolve, reject) => {
- const { server, from } = provider
- // Strip protocol from URL and use domain as site name
- const site = baseUrl.replace(/^https?:\/\//, "")
-
- nodemailer.createTransport(server).sendMail(
- {
- to: email,
- from,
- subject: `Sign in to ${site}`,
- text: text({ url, site, email }),
- html: html({ url, site, email }),
- },
- (error) => {
- if (error) {
- logger.error("SEND_VERIFICATION_EMAIL_ERROR", email, error)
- return reject(new Error("SEND_VERIFICATION_EMAIL_ERROR", error))
- }
- return resolve()
- }
- )
- })
-}
-
-// Email HTML body
-const html = ({ url, site, email }) => {
- // Insert invisible space into domains and email address to prevent both the
- // email address and the domain from being turned into a hyperlink by email
- // clients like Outlook and Apple mail, as this is confusing because it seems
- // like they are supposed to click on their email address to sign in.
- const escapedEmail = `${email.replace(/\./g, ".")}`
- const escapedSite = `${site.replace(/\./g, ".")}`
-
- // Some simple styling options
- const backgroundColor = "#f9f9f9"
- const textColor = "#444444"
- const mainBackgroundColor = "#ffffff"
- const buttonBackgroundColor = "#346df1"
- const buttonBorderColor = "#346df1"
- const buttonTextColor = "#ffffff"
-
- // Uses tables for layout and inline CSS due to email client limitations
- return `
-
-
- If you did not request this email you can safely ignore it.
-
-
-
-
-`
-}
-
-// Email text body – fallback for email clients that don't render HTML
-const text = ({ url, site }) => `Sign in to ${site}\n${url}\n\n`
-```
-
-:::tip
-If you want to generate great looking email client compatible HTML with React, check out https://mjml.io
-:::
-
-## Customising the Verification Token
-
-By default, we are generating a random verification token. You can define a `generateVerificationToken` method in your provider options if you want to override it:
-
-```js title="pages/api/auth/[...nextauth].js"
-providers: [
- Providers.Email({
- async generateVerificationToken() {
- return "ABC123"
- }
- })
-],
-```
diff --git a/www/versioned_docs/version-v3/providers/eveonline.md b/www/versioned_docs/version-v3/providers/eveonline.md
deleted file mode 100644
index 7b02b0e878..0000000000
--- a/www/versioned_docs/version-v3/providers/eveonline.md
+++ /dev/null
@@ -1,65 +0,0 @@
----
-id: eveonline
-title: EVE Online
----
-
-## Documentation
-
-https://developers.eveonline.com/blog/article/sso-to-authenticated-calls
-
-## Configuration
-
-https://developers.eveonline.com/
-
-## Options
-
-The **EVE Online Provider** comes with a set of default options:
-
-- [EVE Online Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/eveonline.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.EVEOnline({
- clientId: process.env.EVE_CLIENT_ID,
- clientSecret: process.env.EVE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip When creating your application, make sure to select `Authentication Only` as the connection type.
-
-:::tip If using JWT for the session, you can add the `CharacterID` to the JWT token and session. Example:
-
-```js
-...
-options: {
- jwt: {
- secret: process.env.JWT_SECRET,
- },
- callbacks: {
- jwt: async (token, user, account, profile, isNewUser) => {
- if (profile) {
- token = {
- ...token,
- id: profile.CharacterID,
- }
- }
- return token;
- },
- session: async (session, token) => {
- if (token) {
- session.user.id = token.id;
- }
- return session;
- }
- }
-}
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/facebook.md b/www/versioned_docs/version-v3/providers/facebook.md
deleted file mode 100644
index c354b9247a..0000000000
--- a/www/versioned_docs/version-v3/providers/facebook.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-id: facebook
-title: Facebook
----
-
-## Documentation
-
-https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/
-
-## Configuration
-
-https://developers.facebook.com/apps/
-
-## Options
-
-The **Facebook Provider** comes with a set of default options:
-
-- [Facebook Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/facebook.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Facebook({
- clientId: process.env.FACEBOOK_CLIENT_ID,
- clientSecret: process.env.FACEBOOK_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-Production applications cannot use localhost URLs to sign in with Facebook. You need to use a dedicated development application in Facebook to use **localhost** callback URLs.
-:::
-
-:::tip
-Email address may not be returned for accounts created on mobile.
-:::
diff --git a/www/versioned_docs/version-v3/providers/faceit.md b/www/versioned_docs/version-v3/providers/faceit.md
deleted file mode 100644
index 2a69d80517..0000000000
--- a/www/versioned_docs/version-v3/providers/faceit.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: faceit
-title: FACEIT
----
-
-## Documentation
-
-https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf
-
-## Configuration
-
-https://developers.faceit.com/apps
-
-Grant type: `Authorization Code`
-
-Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile`
-
-## Options
-
-The **FACEIT Provider** comes with a set of default options:
-
-- [FACEIT Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/faceit.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FACEIT({
- clientId: process.env.FACEIT_CLIENT_ID,
- clientSecret: process.env.FACEIT_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/foursquare.md b/www/versioned_docs/version-v3/providers/foursquare.md
deleted file mode 100644
index 2d0b35fa4f..0000000000
--- a/www/versioned_docs/version-v3/providers/foursquare.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: foursquare
-title: Foursquare
----
-
-## Documentation
-
-https://developer.foursquare.com/docs/places-api/authentication/#web-applications
-
-## Configuration
-
-https://developer.foursquare.com/
-
-:::warning
-Foursquare requires an additional `apiVersion` parameter in [`YYYYMMDD` format](https://developer.foursquare.com/docs/places-api/versioning/), which essentially states "I'm prepared for API changes up to this date".
-
-## Options
-
-The **Foursquare Provider** comes with a set of default options:
-
-- [Foursquare Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/foursquare.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Foursquare({
- clientId: process.env.FOURSQUARE_CLIENT_ID,
- clientSecret: process.env.FOURSQUARE_CLIENT_SECRET,
- apiVersion: 'YYYYMMDD'
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/fusionauth.md b/www/versioned_docs/version-v3/providers/fusionauth.md
deleted file mode 100644
index 4c375e4e22..0000000000
--- a/www/versioned_docs/version-v3/providers/fusionauth.md
+++ /dev/null
@@ -1,55 +0,0 @@
----
-id: fusionauth
-title: FusionAuth
----
-
-## Documentation
-
-https://fusionauth.io/docs/v1/tech/oauth/
-
-## Options
-
-The **FusionAuth Provider** comes with a set of default options:
-
-- [FusionAuth Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/fusionauth.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.FusionAuth({
- id: "fusionauth",
- name: "FusionAuth",
- domain: process.env.FUSIONAUTH_DOMAIN,
- clientId: process.env.FUSIONAUTH_CLIENT_ID,
- clientSecret: process.env.FUSIONAUTH_SECRET,
- tenantId: process.env.FUSIONAUTH_TENANT_ID // Only required if you're using multi-tenancy
- }),
-]
-...
-```
-
-:::warning
-If you're using multi-tenancy, you need to pass in the `tenantId` option to apply the proper theme.
-:::
-
-## Instructions
-
-### Configuration
-
-:::tip
-An application can be created at https://your-fusionauth-server-url/admin/application.
-
-For more information, follow the [FusionAuth 5-minute setup guide](https://fusionauth.io/docs/v1/tech/5-minute-setup-guide).
-:::
-
-In the OAuth settings for your application, configure the following.
-
-- Redirect URL
- - https://localhost:3000/api/auth/callback/fusionauth
-- Enabled grants
- - Make sure _Authorization Code_ is enabled.
diff --git a/www/versioned_docs/version-v3/providers/github.md b/www/versioned_docs/version-v3/providers/github.md
deleted file mode 100644
index b11693cfcb..0000000000
--- a/www/versioned_docs/version-v3/providers/github.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-id: github
-title: GitHub
----
-
-## Documentation
-
-https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps
-
-## Configuration
-
-https://github.com/settings/apps
-
-## Options
-
-The **Github Provider** comes with a set of default options:
-
-- [Github Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/github.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.GitHub({
- clientId: process.env.GITHUB_CLIENT_ID,
- clientSecret: process.env.GITHUB_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Only allows one callback URL per Client ID / Client Secret.
-:::
-
-:::tip
-Email address is not returned if privacy settings are enabled.
-:::
diff --git a/www/versioned_docs/version-v3/providers/gitlab.md b/www/versioned_docs/version-v3/providers/gitlab.md
deleted file mode 100644
index 3455a42320..0000000000
--- a/www/versioned_docs/version-v3/providers/gitlab.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: gitlab
-title: GitLab
----
-
-## Documentation
-
-https://docs.gitlab.com/ee/api/oauth2.html
-
-## Configuration
-
-https://gitlab.com/profile/applications
-
-## Options
-
-The **Gitlab Provider** comes with a set of default options:
-
-- [Gitlab Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/gitlab.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.GitLab({
- clientId: process.env.GITLAB_CLIENT_ID,
- clientSecret: process.env.GITLAB_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-Enable the _"read_user"_ option in scope if you want to save the users email address on sign up.
-:::
diff --git a/www/versioned_docs/version-v3/providers/google.md b/www/versioned_docs/version-v3/providers/google.md
deleted file mode 100644
index a77b7276b5..0000000000
--- a/www/versioned_docs/version-v3/providers/google.md
+++ /dev/null
@@ -1,85 +0,0 @@
----
-id: google
-title: Google
----
-
-## Documentation
-
-https://developers.google.com/identity/protocols/oauth2
-
-## Configuration
-
-https://console.developers.google.com/apis/credentials
-
-## Options
-
-The **Google Provider** comes with a set of default options:
-
-- [Google Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/google.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Google only provide the Refresh Token to an application the first time a user signs in.
-
-To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again:
-https://myaccount.google.com/permissions
-
-Alternatively, you can also pass options in the `authorizationUrl` which will force the Refresh Token to always be provided on sign in, however this will ask all users to confirm if they wish to grant your application access every time they sign in.
-
-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
-const options = {
- ...
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_ID,
- clientSecret: process.env.GOOGLE_SECRET,
- authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&response_type=code',
- })
- ],
- ...
-}
-```
-
-:::
-
-:::tip
-Google also return an `verified_email` boolean property in the OAuth profile.
-
-You can use this property to restrict access to people with verified accounts at a particular domain.
-
-```js
-const options = {
- ...
- callbacks: {
- async signIn(user, account, profile) {
- if (account.provider === 'google' &&
- profile.verified_email === true &&
- profile.email.endsWith('@example.com')) {
- return true
- } else {
- return false
- }
- },
- }
- ...
-}
-```
-
-:::
diff --git a/www/versioned_docs/version-v3/providers/identity-server4.md b/www/versioned_docs/version-v3/providers/identity-server4.md
deleted file mode 100644
index 9eb9211760..0000000000
--- a/www/versioned_docs/version-v3/providers/identity-server4.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-id: identity-server4
-title: IdentityServer4
----
-
-## Documentation
-
-https://identityserver4.readthedocs.io/en/latest/
-
-## Options
-
-The **IdentityServer4 Provider** comes with a set of default options:
-
-- [IdentityServer4 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/identity-server4.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.IdentityServer4({
- id: "identity-server4",
- name: "IdentityServer4",
- scope: "openid profile email api offline_access", // Allowed Scopes
- domain: process.env.IdentityServer4_Domain,
- clientId: process.env.IdentityServer4_CLIENT_ID,
- clientSecret: process.env.IdentityServer4_CLIENT_SECRET
- })
-]
-...
-```
-
-## Demo IdentityServer
-
-The configuration below is for the demo server at https://demo.identityserver.io/
-
-If you want to try it out, you can copy and paste the configuration below.
-
-You can sign in to the demo service with either bob/bob or alice/alice.
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.IdentityServer4({
- id: "demo-identity-server",
- name: "Demo IdentityServer4",
- scope: "openid profile email api offline_access",
- domain: "demo.identityserver.io",
- clientId: "interactive.confidential",
- clientSecret: "secret",
- protection: "pkce"
- })
-}
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/instagram.md b/www/versioned_docs/version-v3/providers/instagram.md
deleted file mode 100644
index 68abd96dfc..0000000000
--- a/www/versioned_docs/version-v3/providers/instagram.md
+++ /dev/null
@@ -1,50 +0,0 @@
----
-id: instagram
-title: Instagram
----
-
-## Documentation
-
-https://developers.facebook.com/docs/instagram-basic-display-api/getting-started
-
-## Configuration
-
-https://developers.facebook.com/apps/
-
-## Options
-
-The **Instagram Provider** comes with a set of default options:
-
-- [Instagram Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/instagram.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```jsx
-// pages/api/auth/[...nextauth].js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Instagram({
- clientId: process.env.INSTAGRAM_CLIENT_ID,
- clientSecret: process.env.INSTAGRAM_CLIENT_SECRET
- })
-]
-...
-// pages/index.jsx
-import { signIn } from "next-auth/client"
-...
-
-...
-```
-
-:::warning
-Email address is not returned by the Instagram API.
-:::
-
-:::tip
-Instagram display app required callback URL to be configured in your Facebook app and Facebook required you to use **https** even for localhost! In order to do that, you either need to [add an SSL to your localhost](https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/) or use a proxy such as [ngrok](https://ngrok.com/docs).
-:::
diff --git a/www/versioned_docs/version-v3/providers/kakao.md b/www/versioned_docs/version-v3/providers/kakao.md
deleted file mode 100644
index 8b40b7e374..0000000000
--- a/www/versioned_docs/version-v3/providers/kakao.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-id: kakao
-title: Kakao
----
-
-## Documentation
-
-https://developers.kakao.com/product/kakaoLogin
-
-## Configuration
-
-https://developers.kakao.com/docs/latest/en/kakaologin/common
-
-## Options
-
-The **Kakao Provider** comes with a set of default options:
-
-- [Kakao Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/kakao.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Kakao({
- clientId: process.env.KAKAO_CLIENT_ID,
- clientSecret: process.env.KAKAO_CLIENT_SECRET
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-Create a provider and a Kakao application at `https://developers.kakao.com/console/app`. In the settings of the app under Kakao Login, activate web app, change consent items and configure callback URL.
diff --git a/www/versioned_docs/version-v3/providers/line.md b/www/versioned_docs/version-v3/providers/line.md
deleted file mode 100644
index 6c659a4882..0000000000
--- a/www/versioned_docs/version-v3/providers/line.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-id: line
-title: LINE
----
-
-## Documentation
-
-https://developers.line.biz/en/docs/line-login/integrate-line-login/
-
-## Configuration
-
-https://developers.line.biz/console/
-
-## Options
-
-The **Line Provider** comes with a set of default options:
-
-- [Line Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/line.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.LINE({
- clientId: process.env.LINE_CLIENT_ID,
- clientSecret: process.env.LINE_CLIENT_SECRET
- })
-]
-...
-```
-
-## Instructions
-
-### Configuration
-
-Create a provider and a LINE login channel at `https://developers.line.biz/console/`. In the settings of the channel under LINE Login, activate web app and configure the following:
-
-- Callback URL
- - http://localhost:3000/api/auth/callback/line
diff --git a/www/versioned_docs/version-v3/providers/linkedin.md b/www/versioned_docs/version-v3/providers/linkedin.md
deleted file mode 100644
index 08273cd58c..0000000000
--- a/www/versioned_docs/version-v3/providers/linkedin.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: linkedin
-title: LinkedIn
----
-
-## Documentation
-
-https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow
-
-## Configuration
-
-https://www.linkedin.com/developers/apps/
-
-From the Auth tab get the client ID and client secret. On the same tab, add redirect URLs such as http://localhost:3000/api/auth/callback/linkedin so LinkedIn can correctly redirect back to your application. Finally, head over to the Products tab and enable the "Sign In with LinkedIn" product. The LinkedIn team will review and approve your request before you can test it out.
-
-![image](https://user-images.githubusercontent.com/330396/114429603-68195600-9b72-11eb-8311-62e58383c42b.png)
-
-## Options
-
-The **LinkedIn Provider** comes with a set of default options:
-
-- [LinkedIn Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/linked-in.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.LinkedIn({
- clientId: process.env.LINKEDIN_CLIENT_ID,
- clientSecret: process.env.LINKEDIN_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/mailchimp.md b/www/versioned_docs/version-v3/providers/mailchimp.md
deleted file mode 100644
index ab600cf861..0000000000
--- a/www/versioned_docs/version-v3/providers/mailchimp.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: mailchimp
-title: Mailchimp
----
-
-## Documentation
-
-https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/
-
-## Configuration
-
-https://admin.mailchimp.com/account/oauth2/client/
-
-## Options
-
-The **Mailchimp Provider** comes with a set of default options:
-
-- [Mailchimp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailchimp.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Mailchimp({
- clientId: process.env.MAILCHIMP_CLIENT_ID,
- clientSecret: process.env.MAILCHIMP_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/mailru.md b/www/versioned_docs/version-v3/providers/mailru.md
deleted file mode 100644
index 530ccfcbd2..0000000000
--- a/www/versioned_docs/version-v3/providers/mailru.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: mailru
-title: Mail.ru
----
-
-## Documentation
-
-https://o2.mail.ru/docs
-
-## Configuration
-
-https://o2.mail.ru/app/
-
-## Options
-
-The **Mail.ru Provider** comes with a set of default options:
-
-- [Mail.ru Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailru.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.MailRu({
- clientId: process.env.MAILRU_CLIENT_ID,
- clientSecret: process.env.MAILRU_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/medium.md b/www/versioned_docs/version-v3/providers/medium.md
deleted file mode 100644
index 751e5a2b43..0000000000
--- a/www/versioned_docs/version-v3/providers/medium.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: medium
-title: Medium
----
-
-## Documentation
-
-https://github.com/Medium/medium-api-docs
-
-## Configuration
-
-https://medium.com/me/applications
-
-## Options
-
-The **Medium Provider** comes with a set of default options:
-
-- [Medium Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/medium.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Medium({
- clientId: process.env.MEDIUM_CLIENT_ID,
- clientSecret: process.env.MEDIUM_CLIENT_SECRET
- })
-}
-...
-```
-
-:::warning
-Email address is not returned by the Medium API.
-:::
diff --git a/www/versioned_docs/version-v3/providers/naver.md b/www/versioned_docs/version-v3/providers/naver.md
deleted file mode 100644
index eb27c4623d..0000000000
--- a/www/versioned_docs/version-v3/providers/naver.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: naver
-title: Naver
----
-
-## Documentation
-
-https://developers.naver.com/docs/login/overview/overview.md
-
-## Configuration
-
-https://developers.naver.com/docs/login/api/api.md
-
-## Options
-
-The **Naver Provider** comes with a set of default options:
-
-- [Naver Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/naver.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Naver({
- clientId: process.env.NAVER_CLIENT_ID,
- clientSecret: process.env.NAVER_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/netlify.md b/www/versioned_docs/version-v3/providers/netlify.md
deleted file mode 100644
index b9c4c07bb8..0000000000
--- a/www/versioned_docs/version-v3/providers/netlify.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: netlify
-title: Netlify
----
-
-## Documentation
-
-https://www.netlify.com/blog/2016/10/10/integrating-with-netlify-oauth2/
-
-## Configuration
-
-https://github.com/netlify/netlify-oauth-example
-
-## Options
-
-The **Netlify Provider** comes with a set of default options:
-
-- [Netlify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/netlify.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Netlify({
- clientId: process.env.NETLIFY_CLIENT_ID,
- clientSecret: process.env.NETLIFY_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/okta.md b/www/versioned_docs/version-v3/providers/okta.md
deleted file mode 100644
index ea4dc7a7bc..0000000000
--- a/www/versioned_docs/version-v3/providers/okta.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-id: okta
-title: Okta
----
-
-## Documentation
-
-https://developer.okta.com/docs/reference/api/oidc
-
-## Options
-
-The **Okta Provider** comes with a set of default options:
-
-- [Okta Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/okta.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Okta({
- clientId: process.env.OKTA_CLIENT_ID,
- clientSecret: process.env.OKTA_CLIENT_SECRET,
- domain: process.env.OKTA_DOMAIN
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/osso.md b/www/versioned_docs/version-v3/providers/osso.md
deleted file mode 100644
index 332d157487..0000000000
--- a/www/versioned_docs/version-v3/providers/osso.md
+++ /dev/null
@@ -1,47 +0,0 @@
----
-id: osso
-title: Osso
----
-
-## Documentation
-
-Osso is an open source service that handles SAML authentication against Identity Providers, normalizes profiles, and makes those profiles available to you in an OAuth 2.0 code grant flow.
-
-If you don't yet have an Osso instance, you can use [Osso's Demo App](https://demo.ossoapp.com) for your testing purposes. For documentation on deploying an Osso instance, see https://ossoapp.com/docs/deploy/overview/
-
-## Configuration
-
-You can configure your OAuth Clients on your Osso Admin UI, i.e. https://demo.ossoapp.com/admin/config - you'll need to get a Client ID and Secret and allow-list your redirect URIs.
-
-[SAML SSO differs a bit from OAuth](https://ossoapp.com/blog/saml-vs-oauth) - for every tenant who wants to sign in to your application using SAML, you and your customer need to perform a multi-step configuration in Osso's Admin UI and the admin dashboard of the tenant's Identity Provider. Osso provides documentation for providers like Okta and OneLogin, cloud-based IDPs who also offer a developer account that's useful for testing. Osso also provides a [Mock IDP](https://idp.ossoapp.com) that you can use for testing without needing to sign up for an Identity Provider service.
-
-See Osso's complete configuration and testing documentation at https://ossoapp.com/docs/configure/overview
-
-## Options
-
-The **Osso Provider** comes with a set of default options:
-
-- [Osso Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/osso.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-A full example application is available at https://github.com/enterprise-oss/osso-next-auth-example and https://nextjs-demo.ossoapp.com
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Osso({
- clientId: process.env.OSSO_CLIENT_ID,
- clientSecret: process.env.OSSO_CLIENT_SECRET,
- domain: process.env.OSSO_DOMAIN
- })
-}
-...
-```
-
-:::note
-`domain` should be the fully qualified domain – e.g. `demo.ossoapp.com`
-:::
diff --git a/www/versioned_docs/version-v3/providers/reddit.md b/www/versioned_docs/version-v3/providers/reddit.md
deleted file mode 100644
index dad51fc5a8..0000000000
--- a/www/versioned_docs/version-v3/providers/reddit.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-id: reddit
-title: Reddit
----
-
-## Documentation
-
-https://www.reddit.com/dev/api/
-
-## Configuration
-
-https://www.reddit.com/prefs/apps/
-
-## Options
-
-The **Reddit Provider** comes with a set of default options:
-
-- [Reddit Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/reddit.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Reddit({
- clientId: process.env.REDDIT_CLIENT_ID,
- clientSecret: process.env.REDDIT_CLIENT_SECRET
- })
-]
-...
-```
-
-:::warning
-Reddit requires authorization every time you go through their page.
-:::
-
-:::warning
-Only allows one callback URL per Client ID / Client Secret.
-:::
-
-:::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
-providers: [
- {
- id: "reddit",
- name: "Reddit",
- clientId: process.env.REDDIT_CLIENT_ID,
- clientSecret: process.env.REDDIT_CLIENT_SECRET,
- scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required.
- type: "oauth",
- version: "2.0",
- params: { grant_type: "authorization_code" },
- accessTokenUrl: " https://www.reddit.com/api/v1/access_token",
- authorizationUrl:
- "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent",
- profileUrl: "https://oauth.reddit.com/api/v1/me",
- profile: (profile) => {
- return {
- id: profile.id,
- name: profile.name,
- email: null,
- }
- },
- },
-]
-```
-
-:::
diff --git a/www/versioned_docs/version-v3/providers/salesforce.md b/www/versioned_docs/version-v3/providers/salesforce.md
deleted file mode 100644
index 2a55b7f5f3..0000000000
--- a/www/versioned_docs/version-v3/providers/salesforce.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-id: salesforce
-title: Salesforce
----
-
-## Documentation
-
-https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&type=5
-
-## Options
-
-The **Salesforce Provider** comes with a set of default options:
-
-- [Salesforce Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/salesforce.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Salesforce({
- clientId: process.env.SALESFORCE_CLIENT_ID,
- clientSecret: process.env.SALESFORCE_CLIENT_SECRET,
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/slack.md b/www/versioned_docs/version-v3/providers/slack.md
deleted file mode 100644
index 64e295d203..0000000000
--- a/www/versioned_docs/version-v3/providers/slack.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-id: slack
-title: Slack
----
-
-## Documentation
-
-https://api.slack.com/authentication
-https://api.slack.com/docs/sign-in-with-slack
-
-## Configuration
-
-https://api.slack.com/apps
-
-## Options
-
-The **Slack Provider** comes with a set of default options:
-
-- [Slack Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/slack.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Slack({
- clientId: process.env.SLACK_CLIENT_ID,
- clientSecret: process.env.SLACK_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/spotify.md b/www/versioned_docs/version-v3/providers/spotify.md
deleted file mode 100644
index 695642fb54..0000000000
--- a/www/versioned_docs/version-v3/providers/spotify.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: spotify
-title: Spotify
----
-
-## Documentation
-
-https://developer.spotify.com/documentation
-
-## Configuration
-
-https://developer.spotify.com/dashboard/applications
-
-## Options
-
-The **Spotify Provider** comes with a set of default options:
-
-- [Spotify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/spotify.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Spotify({
- clientId: process.env.SPOTIFY_CLIENT_ID,
- clientSecret: process.env.SPOTIFY_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/strava.md b/www/versioned_docs/version-v3/providers/strava.md
deleted file mode 100644
index 3df758a90b..0000000000
--- a/www/versioned_docs/version-v3/providers/strava.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-id: strava
-title: Strava
----
-
-## Documentation
-
-http://developers.strava.com/docs/reference/
-
-## Options
-
-The **Strava Provider** comes with a set of default options:
-
-- [Strava Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/strava.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from 'next-auth/providers'
-...
-providers: [
- Providers.Strava({
- clientId: process.env.STRAVA_CLIENT_ID,
- clientSecret: process.env.STRAVA_CLIENT_SECRET,
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/twitch.md b/www/versioned_docs/version-v3/providers/twitch.md
deleted file mode 100644
index d0405e1766..0000000000
--- a/www/versioned_docs/version-v3/providers/twitch.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-id: twitch
-title: Twitch
----
-
-## Documentation
-
-https://dev.twitch.tv/docs/authentication
-
-## Configuration
-
-https://dev.twitch.tv/console/apps
-
-Add the following redirect URL into the console `http:///api/auth/callback/twitch`
-
-## Options
-
-The **Twitch Provider** comes with a set of default options:
-
-- [Twitch Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitch.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitch({
- clientId: process.env.TWITCH_CLIENT_ID,
- clientSecret: process.env.TWITCH_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/twitter.md b/www/versioned_docs/version-v3/providers/twitter.md
deleted file mode 100644
index 7296a1ffde..0000000000
--- a/www/versioned_docs/version-v3/providers/twitter.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-id: twitter
-title: Twitter
----
-
-## Documentation
-
-https://developer.twitter.com
-
-## Configuration
-
-https://developer.twitter.com/en/apps
-
-## Options
-
-The **Twitter Provider** comes with a set of default options:
-
-- [Twitter Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitter.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Twitter({
- clientId: process.env.TWITTER_CLIENT_ID,
- clientSecret: process.env.TWITTER_CLIENT_SECRET
- })
-]
-...
-```
-
-:::tip
-You must enable the _"Request email address from users"_ option in your app permissions if you want to obtain the users email address.
-:::
-
-![twitter](https://user-images.githubusercontent.com/7902980/83944068-1640ca80-a801-11ea-959c-0e744e2144f7.PNG)
diff --git a/www/versioned_docs/version-v3/providers/vk.md b/www/versioned_docs/version-v3/providers/vk.md
deleted file mode 100644
index 83d1e6ce3a..0000000000
--- a/www/versioned_docs/version-v3/providers/vk.md
+++ /dev/null
@@ -1,57 +0,0 @@
----
-id: vk
-title: VK
----
-
-## Documentation
-
-https://vk.com/dev/first_guide
-
-## Configuration
-
-https://vk.com/apps?act=manage
-
-## Options
-
-The **VK Provider** comes with a set of default options:
-
-- [VK Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/vk.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.VK({
- clientId: process.env.VK_CLIENT_ID,
- clientSecret: process.env.VK_CLIENT_SECRET
- })
-]
-...
-```
-
-:::note
-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
-// pages/api/auth/[...nextauth].js
-
-const apiVersion = "5.126"
-...
-providers: [
- Providers.VK({
- accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
- requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`,
- authorizationUrl:
- `https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`,
- profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`,
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/wordpress.md b/www/versioned_docs/version-v3/providers/wordpress.md
deleted file mode 100644
index 2ace7ef885..0000000000
--- a/www/versioned_docs/version-v3/providers/wordpress.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-id: wordpress
-title: WordPress.com
----
-
-## Documentation
-
-https://developer.wordpress.com/docs/oauth2/
-
-## Configuration
-
-https://developer.wordpress.com/apps/
-
-## Options
-
-The **Wordpress Provider** comes with a set of default options:
-
-- [Wordpress Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/wordpress.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.WordPress({
- clientId: process.env.WORDPRESS_CLIENT_ID,
- clientSecret: process.env.WORDPRESS_CLIENT_SECRET
- })
-}
-...
-```
-
-:::tip
-Register your application to obtain Client ID and Client Secret at https://developer.wordpress.com/apps/ Select Type as Web and set Redirect URL to `http://example.com/api/auth/callback/wordpress` where example.com is your site domain.
-:::
diff --git a/www/versioned_docs/version-v3/providers/workos.md b/www/versioned_docs/version-v3/providers/workos.md
deleted file mode 100644
index aee171cd19..0000000000
--- a/www/versioned_docs/version-v3/providers/workos.md
+++ /dev/null
@@ -1,112 +0,0 @@
----
-id: workos
-title: WorkOS
----
-
-## Documentation
-
-https://workos.com/docs/sso/guide
-
-## Configuration
-
-https://dashboard.workos.com
-
-## Options
-
-The **WorkOS Provider** comes with a set of default options:
-
-- [WorkOS Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/workos.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.WorkOS({
- clientId: process.env.WORKOS_CLIENT_ID,
- clientSecret: process.env.WORKOS_API_KEY,
- }),
-],
-...
-```
-
-WorkOS is not an identity provider itself, but, rather, a bridge to multiple single sign-on (SSO) providers. As a result, we need to make some additional changes to authenticate users using WorkOS.
-
-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:
-
-```javascript title="pages/api/auth/[...nextauth].js"
-...
- pages: {
- signIn: '/auth/signin',
- }
-```
-
-We can then add a custom login page that displays an input where the user can enter their email address. We then extract the domain from the user's email address and pass it to the `authorizationParams` parameter on the `signIn` function:
-
-```jsx title="pages/auth/signin.js"
-import { getProviders, signIn } from "next-auth/client"
-
-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 (
-
-
-
- )
- })}
- >
- )
-}
-
-// This is the recommended way for Next.js 9.3 or newer
-export async function getServerSideProps(context) {
- const providers = await getProviders()
- return {
- props: { providers },
- }
-}
-
-/*
-// If older than Next.js 9.3
-SignIn.getInitialProps = async () => {
- return {
- providers: await getProviders()
- }
-}
-*/
-```
diff --git a/www/versioned_docs/version-v3/providers/yandex.md b/www/versioned_docs/version-v3/providers/yandex.md
deleted file mode 100644
index f0fb48bbf6..0000000000
--- a/www/versioned_docs/version-v3/providers/yandex.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: yandex
-title: Yandex
----
-
-## Documentation
-
-https://tech.yandex.com/oauth/doc/dg/concepts/about-docpage/
-
-## Configuration
-
-https://oauth.yandex.com/client/new
-
-## Options
-
-The **Yandex Provider** comes with a set of default options:
-
-- [Yandex Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/yandex.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Yandex({
- clientId: process.env.YANDEX_CLIENT_ID,
- clientSecret: process.env.YANDEX_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/zoho.md b/www/versioned_docs/version-v3/providers/zoho.md
deleted file mode 100644
index 739d882b1d..0000000000
--- a/www/versioned_docs/version-v3/providers/zoho.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: zoho
-title: Zoho
----
-
-## Documentation
-
-https://www.zoho.com/accounts/protocol/oauth/web-server-applications.html
-
-## Configuration
-
-https://api-console.zoho.com/
-
-## Options
-
-The **Zoho Provider** comes with a set of default options:
-
-- [Zoho Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoho.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Zoho({
- clientId: process.env.ZOHO_CLIENT_ID,
- clientSecret: process.env.ZOHO_CLIENT_SECRET
- })
-]
-...
-```
diff --git a/www/versioned_docs/version-v3/providers/zoom.md b/www/versioned_docs/version-v3/providers/zoom.md
deleted file mode 100644
index 2c6c0969ce..0000000000
--- a/www/versioned_docs/version-v3/providers/zoom.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-id: zoom
-title: Zoom
----
-
-## Documentation
-
-https://marketplace.zoom.us/docs/guides/auth/oauth
-
-## Configuration
-
-https://marketplace.zoom.us
-
-## Options
-
-The **Zoom Provider** comes with a set of default options:
-
-- [Zoom Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoom.js)
-
-You can override any of the options to suit your own use case.
-
-## Example
-
-```js
-import Providers from `next-auth/providers`
-...
-providers: [
- Providers.Zoom({
- clientId: process.env.ZOOM_CLIENT_ID,
- clientSecret: process.env.ZOOM_CLIENT_SECRET
- })
-}
-...
-```
diff --git a/www/versioned_docs/version-v3/tutorials.md b/www/versioned_docs/version-v3/tutorials.md
deleted file mode 100644
index 0efa486e16..0000000000
--- a/www/versioned_docs/version-v3/tutorials.md
+++ /dev/null
@@ -1,96 +0,0 @@
----
-id: tutorials
-title: Tutorials and Explainers
----
-
-## NextAuth.js tutorials
-
-_These tutorials are contributed by the community and hosted on this site._
-
-_New submissions and edits are welcome!_
-
-### [NextJS Authentication Crash Course with NextAuth.js](https://youtu.be/o_wZIVmWteQ)
-
-This tutorial dives in to the ins and outs of NextAuth including email, GitHub, Twitter and integrating with Auth0 in under hour.
-
-### [Create your own NextAuth.js Login Pages](https://youtu.be/kB6YNYZ63fw)
-
-This tutorial shows you how to jump in and create your own custom login pages versus using the ones provided by NextAuth.js
-
-### [Refresh Token Rotation](tutorials/refresh-token-rotation)
-
-How to implement refresh token rotation.
-
-### [Securing pages and API routes](tutorials/securing-pages-and-api-routes)
-
-How to restrict access to pages and API routes.
-
-### [Custom models with TypeORM](tutorials/typeorm-custom-models)
-
-How to use models with custom properties using the TypeORM adapter.
-
-### [Creating a database adapter](tutorials/creating-a-database-adapter)
-
-How to create a custom adapter, to use any database to fetch and store user / account data.
-
-### [LDAP Authentication](tutorials/ldap-auth-example)
-
-How to use the Credentials Provider to authenticate against an LDAP database.
-
-This approach can be used to authenticate existing user accounts against any backend.
-
-### [Testing with Cypress](tutorials/testing-with-cypress)
-
-How to write tests using Cypress.
-
-### [Usage with class components](tutorials/usage-with-class-components)
-
-How to use `useSession()` hook with class components.
-
-## Other tutorials and explainers
-
-_These are tutorials and explainers that have been submitted or that we have found on the web and are hosted elsewhere They include articles, videos and example projects. Submissions for inclusion are welcome!_
-
-### [Adding social authentication support to a Next.js app](https://getstarted.sh/bulletproof-next/add-social-authentication)
-
-A tutorial by Arunoda Susirpiala. Checkout [GetStarted](https://getstarted.sh/) for more examples.
-
-### [Add auth support to a Next.js app with a custom backend](https://arunoda.me/blog/add-auth-support-to-a-next-js-app-with-a-custom-backend)
-
-A tutorial by Arunoda Susirpiala.
-
-### [How to Configure Azure AD B2C Authentication with Next.js](https://benjaminwfox.com/blog/tech/how-to-configure-azure-b2c-with-nextjs)
-
-Configuring authentication with Azure B2C in Next.js is not a particularly straight forward process. We'll look at how to facilitate this using the NextAuth.js library. By Ben Fox.
-
-### [Authentication patterns for Next.js](https://leerob.io/blog/nextjs-authentication)
-
-Next.js supports multiple patterns for authentication, each designed for different use cases. This guide will allow you to choose your adventure based on your constraints. By Lee Robinson.
-
-### [Passwordless Authentication with next-auth](https://www.youtube.com/watch?v=GPBD3acOx_M)
-
-A video tutorial by Xiaoru Li from Prisma.
-
-### [Passwordless Authentication with Next.js, Prisma, and next-auth](https://dev.to/prisma/passwordless-authentication-with-next-js-prisma-and-next-auth-5g8g)
-
-In this post, you'll learn how to add passwordless authentication to your Next.js app using Prisma and next-auth. By the end of this tutorial, your users will be able to log in to your app with either their GitHub account or a Slack-styled magic link sent right to their Email inbox. By Xiaoru Li.
-
-### [Fullstack Authentication Example with Next.js and NextAuth.js](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes-auth)
-
-This example shows how to implement a fullstack app in TypeScript with Next.js using React (frontend), Next.js API routes and Prisma Client (backend). It also demonstrates how to implement authentication using NextAuth.js. By Nikolas Burk at Prisma.
-
-### [Adding Authentication to an existing Next.js Application in no time!](https://dev.to/ndom91/adding-authentication-to-an-existing-serverless-next-js-app-in-no-time-with-nextauth-js-192h)
-
-This `dev.to` tutorial walks one through adding NextAuth.js to an existing project. Including setting up the OAuth client id and secret, adding the API routes for authentication, protecting pages and API routes behind that authentication, etc.
-
-### [Introduction to NextAuth.js](https://www.youtube.com/watch?v=npZsJxWntJM)
-
-This is an introductory video to NextAuth.js for beginners. In this video, it is explained how to set up authentication in a few easy steps and add different configurations to make it more robust and secure.
-
-### [Adding Sign in With Apple Next JS](https://thesiddd.com/blog/apple-auth)
-
-This tutorial walks step by step on how to get Sign In with Apple working (both locally and on a deployed website) using NextAuth.js.
-
-### [How to Authenticate Next.js Apps with Twitter & NextAuth.js](https://spacejelly.dev/posts/how-to-authenticate-next-js-apps-with-twitter-nextauth-js/)
-
-Learn how to add Twitter authentication and login to a Next.js app both clientside and serverside with NextAuth.js.
diff --git a/www/versioned_docs/version-v3/tutorials/creating-a-database-adapter.md b/www/versioned_docs/version-v3/tutorials/creating-a-database-adapter.md
deleted file mode 100644
index 194dc4df81..0000000000
--- a/www/versioned_docs/version-v3/tutorials/creating-a-database-adapter.md
+++ /dev/null
@@ -1,134 +0,0 @@
----
-id: creating-a-database-adapter
-title: Creating a database adapter
----
-
-Using a custom adapter you can connect to any database backend or even several different databases. Custom adapters created and maintained by our community can be found in the [adapters repository](https://github.com/nextauthjs/adapters). Feel free to add a custom adapter from your project to the repository, or even become a maintainer of a certain adapter. Custom adapters can still be created and used in a project without being added to the repository.
-
-Creating a custom adapter can be considerable undertaking and will require some trial and error and some reverse engineering using the built-in adapters for reference.
-
-## How to create an adapter
-
-From an implementation perspective, an adapter in NextAuth.js is a function which returns an async `getAdapter()` method, which in turn returns a Promise with a list of functions used to handle operations such as creating user, linking a user and an OAuth account or handling reading and writing sessions.
-
-It uses this approach to allow database connection logic to live in the `getAdapter()` method. By calling the function just before an action needs to happen, it is possible to check database connection status and handle connecting / reconnecting to a database as required.
-
-_See the code below for practical example._
-
-### Required methods
-
-These methods are required for all sign in flows:
-
-- createUser
-- getUser
-- getUserByEmail
-- getUserByProviderAccountId
-- linkAccount
-- createSession
-- getSession
-- updateSession
-- deleteSession
-- updateUser
-
-These methods are required to support email / passwordless sign in:
-
-- createVerificationRequest
-- getVerificationRequest
-- deleteVerificationRequest
-
-### Unimplemented methods
-
-These methods will be required in a future release, but are not yet invoked:
-
-- deleteUser
-- unlinkAccount
-
-### Example code
-
-```js
-export default function YourAdapter (config, options = {}) {
- return {
- async getAdapter (appOptions) {
- async createUser (profile) {
- return null
- },
- async getUser (id) {
- return null
- },
- async getUserByEmail (email) {
- return null
- },
- async getUserByProviderAccountId (
- providerId,
- providerAccountId
- ) {
- return null
- },
- async updateUser (user) {
- return null
- },
- async deleteUser (userId) {
- return null
- },
- async linkAccount (
- userId,
- providerId,
- providerType,
- providerAccountId,
- refreshToken,
- accessToken,
- accessTokenExpires
- ) {
- return null
- },
- async unlinkAccount (
- userId,
- providerId,
- providerAccountId
- ) {
- return null
- },
- async createSession (user) {
- return null
- },
- async getSession (sessionToken) {
- return null
- },
- async updateSession (
- session,
- force
- ) {
- return null
- },
- async deleteSession (sessionToken) {
- return null
- },
- async createVerificationRequest (
- identifier,
- url,
- token,
- secret,
- provider
- ) {
- return null
- },
- async getVerificationRequest (
- identifier,
- token,
- secret,
- provider
- ) {
- return null
- },
- async deleteVerificationRequest (
- identifier,
- token,
- secret,
- provider
- ) {
- return null
- }
- }
- }
-}
-```
diff --git a/www/versioned_docs/version-v3/tutorials/ldap-auth.md b/www/versioned_docs/version-v3/tutorials/ldap-auth.md
deleted file mode 100644
index 37a39e24c4..0000000000
--- a/www/versioned_docs/version-v3/tutorials/ldap-auth.md
+++ /dev/null
@@ -1,82 +0,0 @@
----
-id: ldap-auth-example
-title: LDAP Authentication
----
-
-NextAuth.js provides the ability to setup a [custom Credential provider](/configuration/providers#sign-in-with-credentials) which we can take advantage of to authenticate users against an existing LDAP server.
-
-You will need an additional dependency, `ldapjs`, which you can install by running `npm install ldapjs`.
-
-Then you must setup the `Providers.Credentials()` provider key like so:
-
-```js title="[...nextauth].js"
-const ldap = require("ldapjs")
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-export default NextAuth({
- providers: [
- Providers.Credentials({
- name: "LDAP",
- credentials: {
- username: { label: "DN", type: "text", placeholder: "" },
- password: { label: "Password", type: "password" },
- },
- async authorize(credentials, req) {
- // You might want to pull this call out so we're not making a new LDAP client on every login attemp
- const client = ldap.createClient({
- url: process.env.LDAP_URI,
- })
-
- // Essentially promisify the LDAPJS client.bind function
- return new Promise((resolve, reject) => {
- client.bind(credentials.username, credentials.password, (error) => {
- if (error) {
- console.error("Failed")
- reject()
- } else {
- console.log("Logged in")
- resolve({
- username: credentials.username,
- password: credentials.password,
- })
- }
- })
- })
- },
- }),
- ],
- callbacks: {
- async jwt(token, user, account, profile, isNewUser) {
- const isSignIn = user ? true : false
- if (isSignIn) {
- token.username = user.username
- token.password = user.password
- }
- return token
- },
- async session(session, user) {
- return { ...session, user: { username: user.username } }
- },
- },
- secret: process.env.NEXTAUTH_SECRET,
- jwt: {
- secret: process.env.NEXTAUTH_SECRET,
- encryption: true, // Very important to encrypt the JWT, otherwise you're leaking username+password into the browser
- },
-})
-```
-
-The idea is that once one is authenticated with the LDAP server, one can pass through both the username/DN and password to the JWT stored in the browser.
-
-This is then passed back to any API routes and retrieved as such:
-
-```js title="/pages/api/doLDAPWork.js"
-token = await jwt.getToken({
- req,
- secret: process.env.NEXTAUTH_SECRET,
-})
-const { username, password } = token
-```
-
-> Thanks to [Winwardo](https://github.com/Winwardo) for the code example
diff --git a/www/versioned_docs/version-v3/tutorials/refresh-token-rotation.md b/www/versioned_docs/version-v3/tutorials/refresh-token-rotation.md
deleted file mode 100644
index 1400d7607a..0000000000
--- a/www/versioned_docs/version-v3/tutorials/refresh-token-rotation.md
+++ /dev/null
@@ -1,139 +0,0 @@
----
-id: refresh-token-rotation
-title: Refresh Token Rotation
----
-
-While NextAuth.js doesn't automatically handle access token rotation for OAuth providers yet, this functionality can be implemented using [callbacks](https://next-auth.js.org/configuration/callbacks).
-
-## Source Code
-
-_A working example can be accessed [here](https://github.com/lawrencecchen/next-auth-refresh-tokens)._
-
-## Implementation
-
-### Server Side
-
-Using a [JWT callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) and a [session callback](https://next-auth.js.org/configuration/callbacks#session-callback), we can persist OAuth tokens and refresh them when they expire.
-
-Below is a sample implementation using Google's Identity Provider. Please note that the OAuth 2.0 request in the `refreshAccessToken()` function will vary between different providers, but the core logic should remain similar.
-
-```js title="pages/auth/[...nextauth.js]"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-
-const GOOGLE_AUTHORIZATION_URL =
- "https://accounts.google.com/o/oauth2/v2/auth?" +
- new URLSearchParams({
- prompt: "consent",
- access_type: "offline",
- response_type: "code",
- })
-
-/**
- * Takes a token, and returns a new token with updated
- * `accessToken` and `accessTokenExpires`. If an error occurs,
- * returns the old token and an error property
- */
-async function refreshAccessToken(token) {
- try {
- const url =
- "https://oauth2.googleapis.com/token?" +
- new URLSearchParams({
- client_id: process.env.GOOGLE_CLIENT_ID,
- client_secret: process.env.GOOGLE_CLIENT_SECRET,
- grant_type: "refresh_token",
- refresh_token: token.refreshToken,
- })
-
- const response = await fetch(url, {
- headers: {
- "Content-Type": "application/x-www-form-urlencoded",
- },
- method: "POST",
- })
-
- const refreshedTokens = await response.json()
-
- if (!response.ok) {
- throw refreshedTokens
- }
-
- return {
- ...token,
- accessToken: refreshedTokens.access_token,
- accessTokenExpires: Date.now() + refreshedTokens.expires_in * 1000,
- refreshToken: refreshedTokens.refresh_token ?? token.refreshToken, // Fall back to old refresh token
- }
- } catch (error) {
- console.log(error)
-
- return {
- ...token,
- error: "RefreshAccessTokenError",
- }
- }
-}
-
-export default NextAuth({
- providers: [
- Providers.Google({
- clientId: process.env.GOOGLE_CLIENT_ID,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET,
- authorizationUrl: GOOGLE_AUTHORIZATION_URL,
- }),
- ],
- callbacks: {
- async jwt(token, user, account) {
- // Initial sign in
- if (account && user) {
- return {
- accessToken: account.accessToken,
- accessTokenExpires: Date.now() + account.expires_in * 1000,
- refreshToken: account.refresh_token,
- user,
- }
- }
-
- // Return previous token if the access token has not expired yet
- if (Date.now() < token.accessTokenExpires) {
- return token
- }
-
- // Access token has expired, try to update it
- return refreshAccessToken(token)
- },
- async session(session, token) {
- if (token) {
- session.user = token.user
- session.accessToken = token.accessToken
- session.error = token.error
- }
-
- return session
- },
- },
-})
-```
-
-### Client Side
-
-The `RefreshAccessTokenError` error that is caught in the `refreshAccessToken()` method is passed all the way to the client. This means that you can direct the user to the sign in flow if we cannot refresh their token.
-
-We can handle this functionality as a side effect:
-
-```js title="pages/auth/[...nextauth.js]"
-import { signIn, useSession } from "next-auth/client";
-import { useEffect } from "react";
-
-const HomePage() {
- const [session] = useSession();
-
- useEffect(() => {
- if (session?.error === "RefreshAccessTokenError") {
- signIn(); // Force sign in to hopefully resolve error
- }
- }, [session]);
-
-return (...)
-}
-```
diff --git a/www/versioned_docs/version-v3/tutorials/securing-pages-and-api-routes.md b/www/versioned_docs/version-v3/tutorials/securing-pages-and-api-routes.md
deleted file mode 100644
index c927389684..0000000000
--- a/www/versioned_docs/version-v3/tutorials/securing-pages-and-api-routes.md
+++ /dev/null
@@ -1,140 +0,0 @@
----
-id: securing-pages-and-api-routes
-title: Securing pages and API routes
----
-
-You can easily protect client and server side rendered pages and API routes with NextAuth.js.
-
-_You can find working examples of the approaches shown below in the [example project](https://github.com/nextauthjs/next-auth-example/)._
-
-:::tip
-The methods `getSession()` and `getToken()` both return an `object` if a session is valid and `null` if a session is invalid or has expired.
-:::
-
-## Securing Pages
-
-### Client Side
-
-If data on a page is fetched using calls to secure API routes - i.e. routes which use `getSession()` or `getToken()` to access the session - you can use the `useSession` React Hook to secure pages.
-
-```js title="pages/client-side-example.js"
-import { useSession, getSession } from "next-auth/client"
-
-export default function Page() {
- const [session, loading] = useSession()
-
- if (loading) return null
-
- if (!loading && !session) return
Access Denied
-
- return (
- <>
-
Protected Page
-
You can view this page because you are signed in.
- >
- )
-}
-```
-
-### Server Side
-
-You can protect server side rendered pages using the `getSession()` method.
-
-```js title="pages/server-side-example.js"
-import { useSession, getSession } from "next-auth/client"
-
-export default function Page() {
- const [session, loading] = useSession()
-
- if (typeof window !== "undefined" && loading) return null
-
- if (session) {
- return (
- <>
-
Protected Page
-
You can view this page because you are signed in.
- >
- )
- }
- return
Access Denied
-}
-
-export async function getServerSideProps(context) {
- const session = await getSession(context)
- return {
- props: { session },
- }
-}
-```
-
-:::tip
-This example assumes you have configured `_app.js` to pass the `session` prop through so that it's immediately available on page load to `useSession`.
-
-```js title="pages/_app.js"
-import { Provider } from "next-auth/client"
-
-export default ({ Component, pageProps }) => {
- return (
-
-
-
- )
-}
-```
-
-:::
-
-## Securing API Routes
-
-### Using getSession()
-
-You can protect API routes using the `getSession()` method.
-
-```js title="pages/api/get-session-example.js"
-import { getSession } from "next-auth/client"
-
-export default async (req, res) => {
- const session = await getSession({ req })
- if (session) {
- // Signed in
- console.log("Session", JSON.stringify(session, null, 2))
- } else {
- // Not Signed in
- res.status(401)
- }
- res.end()
-}
-```
-
-### Using getToken()
-
-If you are using JSON Web Tokens you can use the `getToken()` helper to access the contents of the JWT without having to handle JWT decryption / verification yourself. This method can only be used server side.
-
-```js title="pages/api/get-token-example.js"
-// This is an example of how to read a JSON Web Token from an API route
-import jwt from "next-auth/jwt"
-
-const secret = process.env.SECRET
-
-export default async (req, res) => {
- const token = await jwt.getToken({ req, secret })
- if (token) {
- // Signed in
- console.log("JSON Web Token", JSON.stringify(token, null, 2))
- } else {
- // Not Signed in
- res.status(401)
- }
- res.end()
-}
-```
-
-:::tip
-You can use the `getToken()` helper function in any application as long as you set the `NEXTAUTH_URL` environment variable and the application is able to read the JWT cookie (e.g. is on the same domain).
-:::
-
-:::note
-Pass `getToken` the same value for `secret` as specified in `pages/api/auth/[...nextauth].js`.
-
-See [the documentation for the JWT option](/configuration/options#jwt) for more information.
-:::
diff --git a/www/versioned_docs/version-v3/tutorials/testing-with-cypress.md b/www/versioned_docs/version-v3/tutorials/testing-with-cypress.md
deleted file mode 100644
index cef70e5195..0000000000
--- a/www/versioned_docs/version-v3/tutorials/testing-with-cypress.md
+++ /dev/null
@@ -1,126 +0,0 @@
----
-id: testing-with-cypress
-title: Testing with Cypress
----
-
-To test an implementation of NextAuth.js, we encourage you to use [Cypress](https://cypress.io).
-
-## Setting up Cypress
-
-To get started, install the dependencies:
-
-`npm install --save-dev cypress cypress-social-logins @testing-library/cypress`
-
-:::note
-If you are using username/password based login, you will not need the `cypress-social-login` dependency.
-:::
-
-Cypress will install and initialize the folder structure with example integration tests, a folder for plugins, etc.
-
-Next you will have to create some configuration files for Cypress.
-
-First, the primary cypress config:
-
-```js title="cypress.json"
-{
- "baseUrl": "http://localhost:3000",
- "chromeWebSecurity": false
-}
-```
-
-This initial Cypress config will tell Cypress where to find your site on initial launch as well as allow it to open up URLs at domains that aren't your page, for example to be able to login to a social provider.
-
-Second, a cypress file for environment variables. These can be defined in `cypress.json` under the key `env` as well, however since we're storing username / passwords in here we should keep those in a separate file and only commit `cypress.json` to version control, not `cypress.env.json`.
-
-```js title="cypress.env.json"
-{
- "GOOGLE_USER": "username@company.com",
- "GOOGLE_PW": "password",
- "COOKIE_NAME": "next-auth.session-token",
- "SITE_NAME": "http://localhost:3000"
-}
-```
-
-You must change the login credentials you want to use, but you can also redefine the name of the `GOOGLE_*` variables if you're using a different provider. `COOKIE_NAME`, however, must be set to that value for NextAuth.js.
-
-Third, if you're using the `cypress-social-login` plugin, you must add this to your `/cypress/plugins/index.js` file like so:
-
-```js title="cypress/plugins/index.js"
-const { GoogleSocialLogin } = require("cypress-social-logins").plugins
-
-module.exports = (on, config) => {
- on("task", {
- GoogleSocialLogin: GoogleSocialLogin,
- })
-}
-```
-
-Finally, you can also add the following npm scripts to your `package.json`:
-
-```json
-"test:e2e:open": "cypress open",
-"test:e2e:run": "cypress run"
-```
-
-## Writing a test
-
-Once we've got all that configuration out of the way, we can begin writing tests to login using NextAuth.js.
-
-The basic login test looks like this:
-
-```js title="cypress/integration/login.js"
-describe("Login page", () => {
- before(() => {
- cy.log(`Visiting https://company.tld`)
- cy.visit("/")
- })
- it("Login with Google", () => {
- const username = Cypress.env("GOOGLE_USER")
- const password = Cypress.env("GOOGLE_PW")
- const loginUrl = Cypress.env("SITE_NAME")
- const cookieName = Cypress.env("COOKIE_NAME")
- const socialLoginOptions = {
- username,
- password,
- loginUrl,
- headless: true,
- logs: false,
- isPopup: true,
- loginSelector: `a[href="${Cypress.env(
- "SITE_NAME"
- )}/api/auth/signin/google"]`,
- postLoginSelector: ".unread-count",
- }
-
- return cy
- .task("GoogleSocialLogin", socialLoginOptions)
- .then(({ cookies }) => {
- cy.clearCookies()
-
- const cookie = cookies
- .filter((cookie) => cookie.name === cookieName)
- .pop()
- if (cookie) {
- cy.setCookie(cookie.name, cookie.value, {
- domain: cookie.domain,
- expiry: cookie.expires,
- httpOnly: cookie.httpOnly,
- path: cookie.path,
- secure: cookie.secure,
- })
-
- Cypress.Cookies.defaults({
- preserve: cookieName,
- })
-
- // remove the two lines below if you need to stay logged in
- // for your remaining tests
- cy.visit("/api/auth/signout")
- cy.get("form").submit()
- }
- })
- })
-})
-```
-
-Things to note here include, that you must adjust the CSS selector defined under `postLoginSelector` to match a selector found on your page after the user is logged in. This is how Cypress knows whether it succeeded or not. Also, if you're using another provider, you will have to adjust the `loginSelector` URL.
diff --git a/www/versioned_docs/version-v3/tutorials/typeorm-custom-models.md b/www/versioned_docs/version-v3/tutorials/typeorm-custom-models.md
deleted file mode 100644
index a1ee1f5926..0000000000
--- a/www/versioned_docs/version-v3/tutorials/typeorm-custom-models.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-id: typeorm-custom-models
-title: Custom models with TypeORM
----
-
-NextAuth.js provides a set of [models and schemas](/adapters/models) for the built-in TypeORM adapter that you can easily extend.
-
-You can use these models with MySQL, MariaDB, Postgres, MongoDB and SQLite.
-
-## Creating custom models
-
-```js title="models/User.js"
-import Adapters from "next-auth/adapters"
-
-// Extend the built-in models using class inheritance
-export default class User extends Adapters.TypeORM.Models.User.model {
- // You can extend the options in a model but you should not remove the base
- // properties or change the order of the built-in options on the constructor
- constructor(name, email, image, emailVerified) {
- super(name, email, image, emailVerified)
- }
-}
-
-export const UserSchema = {
- name: "User",
- target: User,
- columns: {
- ...Adapters.TypeORM.Models.User.schema.columns,
- // Adds a phoneNumber to the User schema
- phoneNumber: {
- type: "varchar",
- nullable: true,
- },
- },
-}
-```
-
-```js title="models/index.js"
-// To make importing them easier, you can export all models from single file
-import User, { UserSchema } from "./User"
-
-export default {
- User: {
- model: User,
- schema: UserSchema,
- },
-}
-```
-
-:::note
-[View source for built-in TypeORM models and schemas](https://github.com/nextauthjs/adapters/tree/canary/packages/typeorm-legacy/src/models)
-:::
-
-## Using custom models
-
-You can use custom models by specifying the TypeORM adapter explicitly and passing them as an option.
-
-```js title="pages/api/auth/[...nextauth].js"
-import NextAuth from "next-auth"
-import Providers from "next-auth/providers"
-import Adapters from "next-auth/adapters"
-
-import Models from "../../../models"
-
-export default NextAuth({
- providers: [
- // Your providers
- ],
-
- adapter: Adapters.TypeORM.Adapter(
- // The first argument should be a database connection string or TypeORM config object
- "mysql://username:password@127.0.0.1:3306/database_name",
- // The second argument can be used to pass custom models and schemas
- {
- models: {
- User: Models.User,
- },
- }
- ),
-})
-```
diff --git a/www/versioned_docs/version-v3/tutorials/usage-with-class-components.md b/www/versioned_docs/version-v3/tutorials/usage-with-class-components.md
deleted file mode 100644
index e4c6699928..0000000000
--- a/www/versioned_docs/version-v3/tutorials/usage-with-class-components.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-id: usage-with-class-components
-title: Usage with class components
----
-
-If you want to use the `useSession()` hook in your class components you can do so with the help of a higher order component or with a render prop.
-
-## Higher Order Component
-
-```js
-import { useSession } from "next-auth/client"
-
-const withSession = (Component) => (props) => {
- const [session, loading] = useSession()
-
- // if the component has a render property, we are good
- if (Component.prototype.render) {
- return
- }
-
- // if the passed component is a function component, there is no need for this wrapper
- throw new Error(
- [
- "You passed a function component, `withSession` is not needed.",
- "You can `useSession` directly in your component.",
- ].join("\n")
- )
-}
-
-// Usage
-class ClassComponent extends React.Component {
- render() {
- const { session, loading } = this.props
- return null
- }
-}
-
-const ClassComponentWithSession = withSession(ClassComponent)
-```
-
-## Render Prop
-
-```js
-import { useSession } from "next-auth/client"
-
-const UseSession = ({ children }) => {
- const [session, loading] = useSession()
- return children({ session, loading })
-}
-
-// Usage
-class ClassComponent extends React.Component {
- render() {
- return (
-
- {({ session, loading }) => (
-
{JSON.stringify(session, null, 2)}
- )}
-
- )
- }
-}
-```
diff --git a/www/versioned_docs/version-v3/warnings.md b/www/versioned_docs/version-v3/warnings.md
deleted file mode 100644
index ef75927ee1..0000000000
--- a/www/versioned_docs/version-v3/warnings.md
+++ /dev/null
@@ -1,79 +0,0 @@
----
-id: warnings
-title: Warnings
----
-
-This is a list of warning output from NextAuth.js.
-
-All warnings indicate things which you should take a look at, but do not inhibit normal operation.
-
----
-
-## Client
-
-#### NEXTAUTH_URL
-
-Environment variable `NEXTAUTH_URL` missing. Please set it in your `.env` file.
-
----
-
-## Server
-
-These warnings are displayed on the terminal.
-
-#### JWT_AUTO_GENERATED_SIGNING_KEY
-
-To remedy this warning, you can either:
-
-**Option 1**: Pass a pre-regenerated Private Key (and, optionally a Public Key) in the jwt options.
-
-```js title="/pages/api/auth/[...nextauth].js"
-jwt: {
- signingKey: process.env.JWT_SIGNING_PRIVATE_KEY,
-
- // You can also specify a public key for verification if using public/private key (but private only is fine)
- // verificationKey: process.env.JWT_SIGNING_PUBLIC_KEY,
-
- // If you want to use some key format other than HS512 you can specify custom options to use
- // when verifying (note: verificationOptions should include a value for maxTokenAge as well).
- // verificationOptions = {
- // maxTokenAge: `${maxAge}s`, // e.g. `${30 * 24 * 60 * 60}s` = 30 days
- // algorithms: ['HS512']
- // },
-}
-```
-
-You can use [node-jose-tools](https://www.npmjs.com/package/node-jose-tools) to generate keys on the command line and set them as environment variables, i.e. `jose newkey -s 256 -t oct -a HS512`.
-
-**Option 2**: Specify custom encode/decode functions on the jwt object. This gives you complete control over signing / verification / etc.
-
-#### JWT_AUTO_GENERATED_ENCRYPTION_KEY
-
-#### SIGNIN_CALLBACK_REJECT_REDIRECT
-
-You returned something in the `signIn` callback, that is being deprecated.
-
-You probably had something similar in the callback:
-
-```js
-return Promise.reject("/some/url")
-```
-
-or
-
-```js
-throw "/some/url"
-```
-
-To remedy this, simply return the url instead:
-
-```js
-return "/some/url"
-```
-
-#### STATE_OPTION_DEPRECATION
-
-You provided `state: true` or `state: false` as a provider option. This is being deprecated in a later release in favour of `protection: "state"` and `protection: "none"` respectively. To remedy this warning:
-
-- If you use `state: true`, just simply remove it. The default is `protection: "state"` already..
-- If you use `state: false`, set `protection: "none"`.
diff --git a/www/versioned_sidebars/version-v3-sidebars.json b/www/versioned_sidebars/version-v3-sidebars.json
deleted file mode 100644
index 5ec4be0843..0000000000
--- a/www/versioned_sidebars/version-v3-sidebars.json
+++ /dev/null
@@ -1,147 +0,0 @@
-{
- "version-v3/docs": [
- {
- "collapsed": false,
- "type": "category",
- "label": "Getting Started",
- "items": [
- {
- "type": "doc",
- "id": "version-v3/getting-started/introduction"
- },
- {
- "type": "doc",
- "id": "version-v3/getting-started/example"
- },
- {
- "type": "doc",
- "id": "version-v3/getting-started/client"
- },
- {
- "type": "doc",
- "id": "version-v3/getting-started/rest-api"
- },
- {
- "type": "doc",
- "id": "version-v3/getting-started/typescript"
- }
- ]
- },
- {
- "collapsed": true,
- "type": "category",
- "label": "Configuration",
- "items": [
- {
- "type": "doc",
- "id": "version-v3/configuration/options"
- },
- {
- "type": "doc",
- "id": "version-v3/configuration/providers"
- },
- {
- "type": "doc",
- "id": "version-v3/configuration/databases"
- },
- {
- "type": "doc",
- "id": "version-v3/configuration/pages"
- },
- {
- "type": "doc",
- "id": "version-v3/configuration/callbacks"
- },
- {
- "type": "doc",
- "id": "version-v3/configuration/events"
- }
- ]
- },
- {
- "collapsed": true,
- "type": "category",
- "label": "Database Adapters",
- "items": [
- {
- "type": "doc",
- "id": "version-v3/adapters/overview"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/models"
- },
- {
- "collapsed": true,
- "type": "category",
- "label": "TypeORM",
- "items": [
- {
- "type": "doc",
- "id": "version-v3/adapters/typeorm/typeorm-overview"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/typeorm/mysql"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/typeorm/postgres"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/typeorm/mssql"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/typeorm/mongodb"
- }
- ]
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/fauna"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/prisma"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/prisma-legacy"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/dynamodb"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/firebase"
- },
- {
- "type": "doc",
- "id": "version-v3/adapters/pouchdb"
- }
- ]
- },
- {
- "collapsed": true,
- "type": "category",
- "label": "Authentication Providers",
- "items": [
- {
- "type": "autogenerated",
- "dirName": "providers"
- }
- ]
- },
- {
- "type": "doc",
- "id": "version-v3/warnings"
- },
- {
- "type": "doc",
- "id": "version-v3/errors"
- }
- ]
-}
diff --git a/www/versions.json b/www/versions.json
deleted file mode 100644
index 8e95a63e14..0000000000
--- a/www/versions.json
+++ /dev/null
@@ -1 +0,0 @@
-["v3"]