├── .github ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.md ├── labeler.yml └── stale.yml ├── .gitignore ├── .nvmrc ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── README.md ├── docs ├── adapters │ ├── dgraph.md │ ├── dynamodb.md │ ├── fauna.md │ ├── firebase.md │ ├── mikro-orm.md │ ├── models.md │ ├── mongodb.md │ ├── neo4j.md │ ├── overview.md │ ├── pouchdb.md │ ├── prisma.md │ ├── sequelize.md │ └── typeorm.md ├── configuration │ ├── callbacks.md │ ├── databases.md │ ├── events.md │ ├── initialization.md │ ├── options.md │ ├── pages.md │ └── providers │ │ ├── credentials.md │ │ ├── email.md │ │ └── oauth.md ├── contributors.md ├── errors.md ├── faq.md ├── getting-started │ ├── client.md │ ├── example.md │ ├── introduction.md │ ├── rest-api.md │ ├── typescript.md │ └── upgrade-to-v4.md ├── providers │ ├── 42.md │ ├── apple.md │ ├── atlassian.md │ ├── auth0.md │ ├── azure-ad-b2c.md │ ├── azure-ad.md │ ├── battlenet.md │ ├── box.md │ ├── bungie.md │ ├── cognito.md │ ├── coinbase.md │ ├── credentials.md │ ├── discord.md │ ├── dropbox.md │ ├── email.md │ ├── eveonline.md │ ├── facebook.md │ ├── faceit.md │ ├── foursquare.md │ ├── freshbooks.md │ ├── fusionauth.md │ ├── github.md │ ├── gitlab.md │ ├── google.md │ ├── identity-server4.md │ ├── index.md │ ├── instagram.md │ ├── kakao.md │ ├── keycloak.md │ ├── line.md │ ├── linkedin.md │ ├── mailchimp.md │ ├── mailru.md │ ├── medium.md │ ├── naver.md │ ├── netlify.md │ ├── okta.md │ ├── onelogin.md │ ├── osso.md │ ├── osu.md │ ├── pipedrive.md │ ├── reddit.md │ ├── salesforce.md │ ├── slack.md │ ├── spotify.md │ ├── strava.md │ ├── twitch.md │ ├── twitter.md │ ├── vk.md │ ├── wordpress.md │ ├── workos.md │ ├── yandex.md │ ├── zoho.md │ └── zoom.md ├── security.md ├── tutorials.md ├── tutorials │ ├── creating-a-database-adapter.md │ ├── ldap-auth.md │ ├── refresh-token-rotation.md │ ├── securing-pages-and-api-routes.md │ ├── testing-with-cypress.md │ └── usage-with-class-components.md └── warnings.md ├── docusaurus.config.js ├── package-lock.json ├── package.json ├── scripts └── generate-providers.js ├── sidebars.js ├── src ├── components │ ├── ProviderMarquee.js │ └── ProviderMarqueeStyle.js ├── css │ ├── admonitions.css │ ├── buttons.css │ ├── hero.css │ ├── index.css │ ├── navbar.css │ ├── providers.css │ └── search.css └── pages │ ├── index.js │ ├── index.module.css │ └── seo.js ├── static ├── googlecfaeef9e241b87bc.html └── img │ ├── brand-github-inverted.svg │ ├── brand-github.svg │ ├── brand-npm-inverted.svg │ ├── brand-npm.svg │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── logo.svg │ ├── logo │ ├── logo-sm.png │ ├── logo-xs.png │ └── logo.png │ ├── mesh-1.jpg │ ├── mesh-2.jpg │ ├── mesh-3.jpg │ ├── nextauth_v4_schema.png │ ├── nextjs-logo.svg │ ├── pages_signin.png │ ├── pages_signout.png │ ├── powered-by-vercel.svg │ ├── providers │ ├── apple-black.svg │ ├── auth0.svg │ ├── aws-cognito.svg │ ├── battle.net.svg │ ├── box.svg │ ├── discord.svg │ ├── facebook-2.svg │ ├── github-1.svg │ ├── gitlab.svg │ ├── google-icon.svg │ ├── okta-3.svg │ ├── openid.svg │ ├── slack.svg │ ├── spotify.svg │ └── twitter.svg │ ├── signin-complex.png │ ├── signin.png │ ├── social-media-card.png │ ├── undraw_authentication.svg │ ├── undraw_secure.svg │ └── undraw_social.svg ├── vercel.json ├── versioned_docs └── version-v3 │ ├── adapters │ ├── dynamodb.md │ ├── fauna.md │ ├── firebase.md │ ├── models.md │ ├── overview.md │ ├── pouchdb.md │ ├── prisma-legacy.md │ ├── prisma.md │ └── typeorm │ │ ├── mongodb.md │ │ ├── mssql.md │ │ ├── mysql.md │ │ ├── overview.md │ │ └── postgres.md │ ├── configuration │ ├── callbacks.md │ ├── databases.md │ ├── events.md │ ├── options.md │ ├── pages.md │ └── providers.md │ ├── contributors.md │ ├── errors.md │ ├── faq.md │ ├── getting-started │ ├── client.md │ ├── example.md │ ├── introduction.md │ ├── rest-api.md │ └── typescript.md │ ├── providers │ ├── 42.md │ ├── apple.md │ ├── atlassian.md │ ├── auth0.md │ ├── azure-ad-b2c.md │ ├── basecamp.md │ ├── battlenet.md │ ├── box.md │ ├── bungie.md │ ├── cognito.md │ ├── coinbase.md │ ├── credentials.mdx │ ├── discord.md │ ├── dropbox.md │ ├── email.md │ ├── eveonline.md │ ├── facebook.md │ ├── faceit.md │ ├── foursquare.md │ ├── fusionauth.md │ ├── github.md │ ├── gitlab.md │ ├── google.md │ ├── identity-server4.md │ ├── instagram.md │ ├── kakao.md │ ├── line.md │ ├── linkedin.md │ ├── mailchimp.md │ ├── mailru.md │ ├── medium.md │ ├── naver.md │ ├── netlify.md │ ├── okta.md │ ├── osso.md │ ├── reddit.md │ ├── salesforce.md │ ├── slack.md │ ├── spotify.md │ ├── strava.md │ ├── twitch.md │ ├── twitter.md │ ├── vk.md │ ├── wordpress.md │ ├── workos.md │ ├── yandex.md │ ├── zoho.md │ └── zoom.md │ ├── tutorials.md │ ├── tutorials │ ├── creating-a-database-adapter.md │ ├── ldap-auth.md │ ├── refresh-token-rotation.md │ ├── securing-pages-and-api-routes.md │ ├── testing-with-cypress.md │ ├── typeorm-custom-models.md │ └── usage-with-class-components.md │ └── warnings.md ├── versioned_sidebars └── version-v3-sidebars.json └── versions.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/github/administering-a-repository/displaying-a-sponsor-button-in-your-repository 2 | 3 | open_collective: nextauth 4 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Changes 💡 2 | 3 | 4 | ## Affected issues 🎟 5 | 6 | 7 | ## Screenshot (If Applicable) 📷 8 | 9 | 10 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | src: 2 | - src/**/* 3 | 4 | docs: 5 | - docs/**/* 6 | - versioned_docs/**/* 7 | - versioned_sidebars/**/* 8 | 9 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 90 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 14 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - priority 10 | - bug 11 | # Label to use when marking an issue as stale 12 | staleLabel: stale 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | Hi there! It looks like this issue hasn't had any activity for a while. 16 | It will be closed if no further activity occurs. If you think your issue 17 | is still relevant, feel free to comment on it to keep it open. 18 | Thanks! 19 | # Comment to post when closing a stale issue. Set to `false` to disable 20 | closeComment: > 21 | Hi there! It looks like this issue hasn't had any activity for a while. 22 | To keep things tidy, I am going to close this issue for now. 23 | If you think your issue is still relevant, just leave a comment 24 | and I will reopen it. 25 | Thanks! 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Misc 2 | .DS_Store 3 | 4 | .env 5 | .env.local 6 | .env.development.local 7 | .env.test.local 8 | .env.production.local 9 | 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | yarn.lock 15 | 16 | # Dependencies 17 | node_modules 18 | 19 | # Build dirs 20 | .next 21 | /build 22 | /dist 23 | /build 24 | 25 | # Generated files 26 | .docusaurus 27 | .cache-loader 28 | providers.json 29 | /internals 30 | /providers 31 | /types/providers/* 32 | !types/providers/index.d.ts 33 | !types/providers/email.d.ts 34 | !types/providers/credentials.d.ts 35 | !types/providers/oauth.d.ts 36 | /adapters.d.ts 37 | /adapters.js 38 | /client.d.ts 39 | /client.js 40 | /index.d.ts 41 | /index.js 42 | /jwt.d.ts 43 | /jwt.js 44 | /errors.js 45 | /errors.d.ts 46 | /react.js 47 | /react.d.ts 48 | 49 | # Development app 50 | app/next-auth 51 | app/dist/css 52 | app/package-lock.json 53 | app/yarn.lock 54 | app/prisma/migrations 55 | app/prisma/dev.db* 56 | 57 | # VS 58 | /.vs/slnx.sqlite-journal 59 | /.vs/slnx.sqlite 60 | /.vs 61 | .vscode 62 | 63 | # GitHub Actions runner 64 | /actions-runner 65 | /_work 66 | 67 | # Prisma migrations 68 | /prisma/migrations 69 | 70 | # Tests 71 | /coverage 72 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 16 -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guide 2 | 3 | Contributions and feedback on your experience of using this software are welcome. 4 | 5 | This includes bug reports, feature requests, ideas, pull requests, and examples of how you have used this software. 6 | 7 | Please see the [Code of Conduct](CODE_OF_CONDUCT.md) and follow any templates configured in GitHub when reporting bugs, requesting enhancements, or contributing code. 8 | 9 | Please raise any significant new functionality or breaking change an issue for discussion before raising a Pull Request for it. 10 | 11 | ## For contributors 12 | 13 | Anyone can be a contributor. Either you found a typo, or you have an awesome feature request you could implement, we encourage you to create a Pull Request. 14 | 15 | ### Pull Requests 16 | 17 | - The latest changes are always in `main`, so please make your Pull Request against that branch. 18 | - Pull Requests should be raised for any change 19 | 20 | ### Setting up local environment 21 | 22 | The local environment can be setup by doing the following. 23 | 24 | 1. Clone the repository `$ git clone https://github.com/nextauthjs/docs.git` 25 | 2. Install dependencies `$ npm install` 26 | 3. Start development server `$ npm start` 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | 4 |

NextAuth.js

5 |

Authentication for Next.js

6 |

7 | Open Source. Full Stack. Own Your Data. 8 |

9 |

10 | 11 | Release 12 | 13 | 14 | Bundle Size 15 | 16 | 17 | Downloads 18 | 19 | 20 | Github Stars 21 | 22 | 23 | Github Stable Release 24 | 25 | Github Prelease 26 |

27 |

28 | 29 | ## Overview 30 | 31 | This is the repository for the documentation page for NextAuth.js! 32 | 33 | NextAuth.js is a complete open source authentication solution for [Next.js](http://nextjs.org/) applications. 34 | 35 | This documentation site is based on the [Docusaurus](https://docusaurus.io) framework. 36 | 37 | ## Getting Started 38 | 39 | To start a local environment of this project, please do the following. 40 | 41 | 1. Clone the repository. 42 | 43 | ```bash 44 | $ git clone https://github.com/nextauthjs/docs.git 45 | ``` 46 | 47 | 2. Install dependencies 48 | 49 | ```bash 50 | $ npm install 51 | ``` 52 | 53 | 3. Start the development server 54 | 55 | ```bash 56 | $ npm start 57 | ``` 58 | 59 | And thats all! Now you should have a local copy of this docs site running at [localhost:3000](http://localhost:3000)! 60 | 61 | ## Contributing 62 | 63 | We're open to all community contributions! If you'd like to contribute in any way, please first read our [Contributing Guide](https://github.com/nextauthjs/next-auth/blob/canary/CONTRIBUTING.md). 64 | 65 | ## License 66 | 67 | ISC 68 | -------------------------------------------------------------------------------- /docs/adapters/fauna.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fauna 3 | title: FaunaDB 4 | --- 5 | 6 | # FaunaDB 7 | 8 | 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. 9 | 10 | 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). 11 | 12 | ## Getting Started 13 | 14 | 1. Install the necessary packages 15 | 16 | ```bash npm2yarn 17 | npm install next-auth @next-auth/fauna-adapter faunadb 18 | ``` 19 | 20 | 2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object. 21 | 22 | ```javascript title="pages/api/auth/[...nextauth].js" 23 | import NextAuth from "next-auth" 24 | import { Client as FaunaClient } from "faunadb" 25 | import { FaunaAdapter } from "@next-auth/fauna-adapter" 26 | 27 | const client = new FaunaClient({ 28 | secret: "secret", 29 | scheme: "http", 30 | domain: "localhost", 31 | port: 8443, 32 | }) 33 | 34 | // For more information on each option (and a full list of options) go to 35 | // https://next-auth.js.org/configuration/options 36 | export default NextAuth({ 37 | // https://next-auth.js.org/providers/overview 38 | providers: [], 39 | adapter: FaunaAdapter(client) 40 | ... 41 | }) 42 | ``` 43 | 44 | ## Schema 45 | 46 | Run the following commands inside of the `Shell` tab in the Fauna dashboard to setup the appropriate collections and indexes. 47 | 48 | ```javascript 49 | CreateCollection({ name: "accounts" }) 50 | CreateCollection({ name: "sessions" }) 51 | CreateCollection({ name: "users" }) 52 | CreateCollection({ name: "verification_tokens" }) 53 | CreateIndex({ 54 | name: "account_by_provider_and_provider_account_id", 55 | source: Collection("accounts"), 56 | unique: true, 57 | terms: [ 58 | { field: ["data", "provider"] }, 59 | { field: ["data", "providerAccountId"] }, 60 | ], 61 | }) 62 | CreateIndex({ 63 | name: "session_by_session_token", 64 | source: Collection("sessions"), 65 | unique: true, 66 | terms: [{ field: ["data", "sessionToken"] }], 67 | }) 68 | CreateIndex({ 69 | name: "user_by_email", 70 | source: Collection("users"), 71 | unique: true, 72 | terms: [{ field: ["data", "email"] }], 73 | }) 74 | CreateIndex({ 75 | name: "verification_token_by_identifier_and_token", 76 | source: Collection("verification_tokens"), 77 | unique: true, 78 | terms: [{ field: ["data", "identifier"] }, { field: ["data", "token"] }], 79 | }) 80 | ``` 81 | -------------------------------------------------------------------------------- /docs/adapters/mongodb.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mongodb 3 | title: MongoDB 4 | --- 5 | 6 | # MongoDB 7 | 8 | The MongoDB adapter does not handle connections automatically, so you will have to make sure that you pass the Adapter a `MongoClient` that is connected already. Below you can see an example how to do this. 9 | 10 | ## Usage 11 | 12 | 1. Install the necessary packages 13 | 14 | ```bash npm2yarn 15 | npm install next-auth @next-auth/mongodb-adapter mongodb 16 | ``` 17 | 18 | 2. Add `lib/mongodb.js` 19 | 20 | ```js 21 | // This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb 22 | import { MongoClient } from "mongodb" 23 | 24 | const uri = process.env.MONGODB_URI 25 | const options = { 26 | useUnifiedTopology: true, 27 | useNewUrlParser: true, 28 | } 29 | 30 | let client 31 | let clientPromise 32 | 33 | if (!process.env.MONGODB_URI) { 34 | throw new Error("Please add your Mongo URI to .env.local") 35 | } 36 | 37 | if (process.env.NODE_ENV === "development") { 38 | // In development mode, use a global variable so that the value 39 | // is preserved across module reloads caused by HMR (Hot Module Replacement). 40 | if (!global._mongoClientPromise) { 41 | client = new MongoClient(uri, options) 42 | global._mongoClientPromise = client.connect() 43 | } 44 | clientPromise = global._mongoClientPromise 45 | } else { 46 | // In production mode, it's best to not use a global variable. 47 | client = new MongoClient(uri, options) 48 | clientPromise = client.connect() 49 | } 50 | 51 | // Export a module-scoped MongoClient promise. By doing this in a 52 | // separate module, the client can be shared across functions. 53 | export default clientPromise 54 | ``` 55 | 56 | 3. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object. 57 | 58 | ```js 59 | import NextAuth from "next-auth" 60 | import { MongoDBAdapter } from "@next-auth/mongodb-adapter" 61 | import clientPromise from "lib/mongodb" 62 | 63 | // For more information on each option (and a full list of options) go to 64 | // https://next-auth.js.org/configuration/options 65 | export default NextAuth({ 66 | adapter: MongoDBAdapter(clientPromise), 67 | ... 68 | }) 69 | ``` 70 | -------------------------------------------------------------------------------- /docs/adapters/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: overview 3 | title: Overview 4 | --- 5 | 6 | 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 want to implement certain flows. The [Email Provider](/providers/email) requires an adapter to be able to save [Verification Tokens](/adapters/models#verification-token). 7 | 8 | :::tip 9 | 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 the [FAQ](/faq#json-web-tokens). 10 | ::: 11 | 12 | We have a list of official adapters that are distributed as their own packages under the `@next-auth/{name}-adapter` namespace. Their source code is available in the organization repository at [`nextauthjs/adapters`](https://github.com/nextauthjs/adapters). Any issues regarding these adapters should be opened on that repository. 13 | 14 | - [`prisma`](./prisma) 15 | - [`fauna`](./fauna) 16 | - [`dynamodb`](./dynamodb) 17 | - [`firebase`](./firebase) 18 | - [`pouchdb`](./pouchdb) 19 | - [`mongodb`](./mongodb) 20 | - [`neo4j`](./neo4j) 21 | - [`typeorm-legacy`](./typeorm) 22 | - [`sequelize`](./sequelize) 23 | - [`dgraph`](./dgraph) 24 | 25 | ## Custom Adapter 26 | 27 | If you have a database/backend that we don't officially support, you can create your own adapter. 28 | See the tutorial for [creating a database Adapter](/tutorials/creating-a-database-adapter) for more information. 29 | 30 | :::tip 31 | 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 to get it merged. Tell us if you are interested in becoming a one of the maintainers of any of the official adapters. 32 | ::: 33 | 34 | ### Editor integration 35 | 36 | Adapters are strongly typed, and they rely on the single `Adapter` interface imported from `next-auth/adapters`. 37 | 38 | 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: 39 | 40 | ```js 41 | /** @return { import("next-auth/adapters").Adapter } */ 42 | function MyAdapter() { 43 | return { 44 | // your adapter methods here 45 | } 46 | } 47 | ``` 48 | 49 | :::note 50 | 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. 51 | ::: 52 | -------------------------------------------------------------------------------- /docs/adapters/pouchdb.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: pouchdb 3 | title: PouchDB 4 | --- 5 | 6 | # PouchDB 7 | 8 | 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. 9 | 10 | 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, ...) 11 | 12 | ## Getting Started 13 | 14 | > **Prerequisites**: Your PouchDB instance MUST provide the `pouchdb-find` plugin since it is used internally by the adapter to build and manage indexes 15 | 16 | 1. Install `next-auth` and `@next-auth/pouchdb-adapter` 17 | 18 | ```bash npm2yarn 19 | npm install next-auth @next-auth/pouchdb-adapter 20 | ``` 21 | 22 | 2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object 23 | 24 | ```javascript title="pages/api/auth/[...nextauth].js" 25 | import NextAuth from "next-auth" 26 | import GoogleProvider from "next-auth/providers/google" 27 | import { PouchDBAdapter } from "@next-auth/pouchdb-adapter" 28 | import PouchDB from "pouchdb" 29 | 30 | // Setup your PouchDB instance and database 31 | PouchDB.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter 32 | .plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin 33 | 34 | const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" }) 35 | 36 | // For more information on each option (and a full list of options) go to 37 | // https://next-auth.js.org/configuration/options 38 | export default NextAuth({ 39 | // https://next-auth.js.org/providers/overview 40 | providers: [ 41 | GoogleProvider({ 42 | clientId: process.env.GOOGLE_ID, 43 | clientSecret: process.env.GOOGLE_SECRET, 44 | }), 45 | ], 46 | adapter: PouchDBAdapter(pouchdb), 47 | // ... 48 | }) 49 | ``` 50 | 51 | ## Advanced 52 | 53 | ### Memory-First Caching Strategy 54 | 55 | 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. 56 | 57 | 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. 58 | 59 | This will most likely not increase performance much in a serverless environment due to various reasons such as concurrency, function startup time increases, etc. 60 | 61 | For more details, please see https://pouchdb.com/api.html#sync 62 | -------------------------------------------------------------------------------- /docs/configuration/databases.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: databases 3 | title: Databases 4 | --- 5 | 6 | NextAuth.js offers multiple database adapters. Check out [the overview](/adapters/overview). 7 | 8 | > As of **v4** 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. 9 | 10 | To learn more about databases in NextAuth.js and how they are used, check out [databases in the FAQ](/faq#databases). 11 | 12 | --- 13 | 14 | ## How to use a database 15 | 16 | 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). 17 | -------------------------------------------------------------------------------- /docs/configuration/events.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: events 3 | title: Events 4 | --- 5 | 6 | Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting or handling any other side-effects. 7 | 8 | You can specify a handler for any of these events below, for debugging or for an audit log. 9 | 10 | :::note 11 | 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. 12 | ::: 13 | 14 | ## Events 15 | 16 | ### signIn 17 | 18 | Sent on successful sign in. 19 | 20 | The message will be an object and contain: 21 | 22 | - `user` (from your adapter or from the provider if a `credentials` type provider) 23 | - `account` (from your adapter or the provider) 24 | - `profile` (from the provider, is `undefined` on `credentials` provider, use `user` instead) 25 | - `isNewUser` (whether your adapter had a user for this account already) 26 | 27 | ### signOut 28 | 29 | Sent when the user signs out. 30 | 31 | The message object will contain one of these depending on if you use JWT or database persisted sessions: 32 | 33 | - `token`: The JWT token for this session. 34 | - `session`: The session object from your adapter that is being ended 35 | 36 | ### createUser 37 | 38 | Sent when the adapter is told to create a new user. 39 | 40 | The message object will contain the user. 41 | 42 | ### updateUser 43 | 44 | Sent when the adapter is told to update an existing user. Currently this is only sent when the user verifies their email address. 45 | 46 | The message object will contain the user. 47 | 48 | ### linkAccount 49 | 50 | 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. 51 | 52 | The message object will contain: 53 | 54 | - `user`: The user object from your adapter. 55 | - `providerAccount`: The object returned from the provider. 56 | 57 | ### session 58 | 59 | Sent at the end of a request for the current session. 60 | 61 | The message object will contain one of these depending on if you use JWT or database persisted sessions: 62 | 63 | - `token`: The JWT token for this session. 64 | - `session`: The session object from your adapter. 65 | -------------------------------------------------------------------------------- /docs/configuration/providers/email.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: email 3 | title: Email 4 | --- 5 | 6 | ### How to 7 | 8 | The Email provider sends "magic links" via email that the user can click on to sign in. 9 | You have likely seen them before if you have used software like Slack. 10 | 11 | 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). 12 | 13 | Configuration is similar to other providers, but the options are different: 14 | 15 | ```js title="pages/api/auth/[...nextauth].js" 16 | import EmailProvider from `next-auth/providers/email` 17 | ... 18 | providers: [ 19 | EmailProvider({ 20 | server: process.env.EMAIL_SERVER, 21 | from: process.env.EMAIL_FROM, 22 | // maxAge: 24 * 60 * 60, // How long email links are valid for (default 24h) 23 | }), 24 | ], 25 | ... 26 | ``` 27 | 28 | See the [Email provider documentation](/providers/email) for more information on how to configure email sign in. 29 | 30 | :::note 31 | The email provider requires a database, it cannot be used without one. 32 | ::: 33 | 34 | ### Options 35 | 36 | | Name | Description | Type | Required | 37 | | :---------------------: | :---------------------------------------------------------------------------------: | :------------------------------: | :------: | 38 | | id | Unique ID for the provider | `string` | Yes | 39 | | name | Descriptive name for the provider | `string` | Yes | 40 | | type | Type of provider, in this case `email` | `"email"` | Yes | 41 | | server | Path or object pointing to the email server | `string` or `Object` | Yes | 42 | | sendVerificationRequest | Callback to execute when a verification request is sent | `(params) => Promise` | Yes | 43 | | from | The email address from which emails are sent, default: "" | `string` | No | 44 | | maxAge | How long until the e-mail can be used to log the user in seconds. Defaults to 1 day | `number` | No | 45 | -------------------------------------------------------------------------------- /docs/contributors.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: contributors 3 | title: Contributors 4 | --- 5 | 6 | ## Core Team 7 | 8 | * [Iain Collins](https://github.com/iaincollins) 9 | * [Balázs Orbán](https://github.com/sponsors/balazsorban44) 10 | * [Nico Domino](https://github.com/ndom91) 11 | * [Lluis Agusti](https://github.com/lluia) 12 | * [Lori Karikari](https://github.com/LoriKarikari) 13 | * [Fredrik Pettersen](https://github.com/Fumler) 14 | * [Gerald Nolan](https://github.com/geraldnolan) 15 | * [Jefferson Bledsoe](https://github.com/JeffersonBledsoe) 16 | 17 | _Special thanks to Balazs Orban for acting as core maintainer throughout most of the v3 and v4 lifecycle of NextAuth! Also to Lori Karikari for creating most of the original provider configurations, to Nico Domino for creating and maintaining this documentation site and other core contributions, to Lluis Agusti for many core contributions especially involving TypeScript, to Fredrik Pettersen for creating the original Prisma adapter, to Gerald Nolan for adding support for Sign in with Apple, ._ 18 | 19 | ## Other Contributors 20 | 21 | NextAuth.js as it exists today has been possible thanks to the work of many individual contributors. 22 | 23 | Thank you to the [dozens of individual contributors](https://github.com/nextauthjs/next-auth/graphs/contributors) who have help shaped NextAuth.js. 24 | 25 | ## OpenCollective 26 | 27 | You can find NextAuth.js on OpenCollective. We are very thankful for all of our existing contributors and would be delighted if you or your company would decide to join them. 28 | 29 | More information can be found at: https://opencollective.com/nextauth 30 | 31 | ## History 32 | 33 | NextAuth.js was originally developed by Iain Collins in 2016. 34 | 35 | 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. 36 | -------------------------------------------------------------------------------- /docs/providers/42.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: 42-school 3 | title: 42 School 4 | --- 5 | 6 | :::note 7 | 42 returns a field on `Account` called `created_at` which is a number. See the [docs](https://api.intra.42.fr/apidoc/guides/getting_started#make-basic-requests). Make sure to add this field to your database schema, in case if you are using an [Adapter](/adapters/overview). 8 | ::: 9 | 10 | ## Documentation 11 | 12 | https://api.intra.42.fr/apidoc/guides/web_application_flow 13 | 14 | ## Configuration 15 | 16 | https://profile.intra.42.fr/oauth/applications/new 17 | 18 | ## Options 19 | 20 | The **42 School Provider** comes with a set of default options: 21 | 22 | - [42 School Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/42.ts) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import FortyTwoProvider from `next-auth/providers/42` 30 | ... 31 | providers: [ 32 | FortyTwoProvider({ 33 | clientId: process.env.FORTY_TWO_CLIENT_ID, 34 | clientSecret: process.env.FORTY_TWO_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/providers/atlassian.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: atlassian 3 | title: Atlassian 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo- 9 | 10 | ## Options 11 | 12 | The **Atlassian Provider** comes with a set of default options: 13 | 14 | - [Atlassian Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/atlassian.ts) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import AtlassianProvider from `next-auth/providers/atlassian` 22 | ... 23 | providers: [ 24 | AtlassianProvider({ 25 | clientId: process.env.ATLASSIAN_CLIENT_ID, 26 | clientSecret: process.env.ATLASSIAN_CLIENT_SECRET, 27 | scope: 'write:jira-work read:jira-work read:jira-user offline_access read:me' 28 | }) 29 | ] 30 | ... 31 | ``` 32 | 33 | ## Instructions 34 | 35 | ### Configuration 36 | 37 | :::tip 38 | An app can be created at https://developer.atlassian.com/apps/ 39 | ::: 40 | 41 | Under "Apis and features" in the side menu, configure the following for "OAuth 2.0 (3LO)": 42 | 43 | - Redirect URL 44 | - http://localhost:3000/api/auth/callback/atlassian 45 | 46 | :::warning 47 | To enable access to Jira Platform REST API you must enable User Identity API and add `read:me` to your provider scope option. 48 | ::: 49 | -------------------------------------------------------------------------------- /docs/providers/auth0.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: auth0 3 | title: Auth0 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://auth0.com/docs/api/authentication#authorize-application 9 | 10 | ## Configuration 11 | 12 | https://manage.auth0.com/dashboard 13 | 14 | :::tip 15 | Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App'). 16 | ::: 17 | 18 | ## Options 19 | 20 | The **Auth0 Provider** comes with a set of default options: 21 | 22 | - [Auth0 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/auth0.ts) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import Auth0Provider from "next-auth/providers/auth0" 30 | ... 31 | providers: [ 32 | Auth0Provider({ 33 | clientId: process.env.AUTH0_CLIENT_ID, 34 | clientSecret: process.env.AUTH0_CLIENT_SECRET, 35 | issuer: process.env.AUTH0_ISSUER 36 | }) 37 | ] 38 | ... 39 | ``` 40 | 41 | :::note 42 | `issuer` should be the fully qualified URL – e.g. `https://dev-s6clz2lv.eu.auth0.com` 43 | ::: 44 | -------------------------------------------------------------------------------- /docs/providers/azure-ad.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: azure-ad 3 | title: Azure Active Directory 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow 9 | 10 | ## Configuration 11 | 12 | https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app 13 | 14 | ## Example 15 | 16 | ### To allow specific Active Directory users access: 17 | 18 | - In https://portal.azure.com/ search for "Azure Active Directory", and select your organization. 19 | - Next, go to "App Registration" in the left menu, and create a new one. 20 | - Pay close attention to "Who can use this application or access this API?" 21 | - This allows you to scope access to specific types of user accounts 22 | - Only your tenant, all azure tenants, or all azure tenants and public Microsoft accounts (Skype, Xbox, Outlook.com, etc.) 23 | - When asked for a redirection URL, use `https://yourapplication.com/api/auth/callback/azure-ad` or for development `http://localhost:3000/api/auth/callback/azure-ad`. 24 | - After your App Registration is created, under "Client Credential" create your Client secret. 25 | - Now copy your: 26 | - Application (client) ID 27 | - Directory (tenant) ID 28 | - Client secret (value) 29 | 30 | In `.env.local` create the following entries: 31 | 32 | ``` 33 | AZURE_AD_CLIENT_ID= 34 | AZURE_AD_CLIENT_SECRET= 35 | AZURE_AD_TENANT_ID= 36 | ``` 37 | 38 | 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). 39 | 40 | :::note 41 | Azure AD returns the profile picture in an ArrayBuffer, instead of just a URL to the image, so our provider converts it to a base64 encoded image string and returns that instead. See: https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0#examples. The default image size is 64x64 to avoid [running out of space](https://next-auth.js.org/faq#:~:text=What%20are%20the%20disadvantages%20of%20JSON%20Web%20Tokens%3F) in case the session is saved as a JWT. 42 | ::: 43 | 44 | In `pages/api/auth/[...nextauth].js` find or add the `AzureAD` entries: 45 | 46 | ```js 47 | import AzureADProvider from 'next-auth/providers/azure-ad'; 48 | 49 | ... 50 | providers: [ 51 | AzureADProvider({ 52 | clientId: process.env.AZURE_AD_CLIENT_ID, 53 | clientSecret: process.env.AZURE_AD_CLIENT_SECRET, 54 | tenantId: process.env.AZURE_AD_TENANT_ID, 55 | }), 56 | ] 57 | ... 58 | 59 | ``` 60 | -------------------------------------------------------------------------------- /docs/providers/battlenet.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: battle.net 3 | title: Battle.net 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://develop.battle.net/documentation/guides/using-oauth 9 | 10 | ## Configuration 11 | 12 | https://develop.battle.net/access/clients 13 | 14 | ## Options 15 | 16 | The **Battle.net Provider** comes with a set of default options: 17 | 18 | - [Battle.net Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/battlenet.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import BattleNetProvider from `next-auth/providers/battlenet` 26 | ... 27 | providers: [ 28 | BattleNetProvider({ 29 | clientId: process.env.BATTLENET_CLIENT_ID, 30 | clientSecret: process.env.BATTLENET_CLIENT_SECRET, 31 | region: process.env.BATTLENET_REGION 32 | }) 33 | ] 34 | ... 35 | ``` 36 | -------------------------------------------------------------------------------- /docs/providers/box.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: box 3 | title: Box 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.box.com/reference/ 9 | 10 | ## Configuration 11 | 12 | https://developer.box.com/guides/sso-identities-and-app-users/connect-okta-to-app-users/configure-box/ 13 | 14 | ## Options 15 | 16 | The **Box Provider** comes with a set of default options: 17 | 18 | - [Box Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/box.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import BoxProvider from `next-auth/providers/box` 26 | ... 27 | providers: [ 28 | BoxProvider({ 29 | clientId: process.env.BOX_CLIENT_ID, 30 | clientSecret: process.env.BOX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/cognito.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cognito 3 | title: Amazon Cognito 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html 9 | 10 | ## Configuration 11 | 12 | https://console.aws.amazon.com/cognito/users/ 13 | 14 | You need to select your AWS region to go the the Cognito dashboard. 15 | 16 | ## Options 17 | 18 | The **Amazon Cognito Provider** comes with a set of default options: 19 | 20 | - [Amazon Cognito Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/cognito.ts) 21 | 22 | You can override any of the options to suit your own use case. 23 | 24 | ## Example 25 | 26 | ```js 27 | import CognitoProvider from `next-auth/providers/cognito` 28 | ... 29 | providers: [ 30 | CognitoProvider({ 31 | clientId: process.env.COGNITO_CLIENT_ID, 32 | clientSecret: process.env.COGNITO_CLIENT_SECRET, 33 | issuer: process.env.COGNITO_ISSUER, 34 | }) 35 | ] 36 | ... 37 | ``` 38 | 39 | :::tip 40 | The issuer is a URL, that looks like this: `https://cognito-idp.{region}.amazonaws.com/{PoolId}` 41 | ::: 42 | 43 | `PoolId` is from `General Settings` in Cognito, not to be confused with the App Client ID. 44 | 45 | :::warning 46 | Make sure you select all the appropriate client settings or the OAuth flow will not work. 47 | ::: 48 | 49 | ![cognito](https://user-images.githubusercontent.com/7902980/83951604-cd096e80-a832-11ea-8bd2-c496ec9a16cb.PNG) 50 | -------------------------------------------------------------------------------- /docs/providers/coinbase.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: coinbase 3 | title: Coinbase 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.coinbase.com/api/v2 9 | 10 | ## Configuration 11 | 12 | https://www.coinbase.com/settings/api 13 | 14 | ## Options 15 | 16 | The **Coinbase Provider** comes with a set of default options: 17 | 18 | - [Coinbase Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/coinbase.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import CoinbaseProvider from `next-auth/providers/coinbase` 26 | ... 27 | providers: [ 28 | CoinbaseProvider({ 29 | clientId: process.env.COINBASE_CLIENT_ID, 30 | clientSecret: process.env.COINBASE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | This Provider template has a 2 hour access token to it. A refresh token is also returned. 38 | ::: 39 | -------------------------------------------------------------------------------- /docs/providers/discord.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: discord 3 | title: Discord 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://discord.com/developers/docs/topics/oauth2 9 | 10 | ## Configuration 11 | 12 | https://discord.com/developers/applications 13 | 14 | ## Options 15 | 16 | The **Discord Provider** comes with a set of default options: 17 | 18 | - [Discord Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/discord.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import DiscordProvider from `next-auth/providers/discord` 26 | ... 27 | providers: [ 28 | DiscordProvider({ 29 | clientId: process.env.DISCORD_CLIENT_ID, 30 | clientSecret: process.env.DISCORD_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/dropbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: dropbox 3 | title: Dropbox 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.dropbox.com/oauth-guide 9 | 10 | ## Configuration 11 | 12 | https://www.dropbox.com/developers/apps 13 | 14 | ## Options 15 | 16 | The **Dropbox Provider** comes with a set of default options: 17 | 18 | - [Dropbox Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/dropbox.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import DropboxProvider from `next-auth/providers/dropbox` 26 | ... 27 | providers: [ 28 | DropboxProvider({ 29 | clientId: process.env.DROPBOX_CLIENT_ID, 30 | clientSecret: process.env.DROPBOX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/eveonline.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: eveonline 3 | title: EVE Online 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.eveonline.com/blog/article/sso-to-authenticated-calls 9 | 10 | ## Configuration 11 | 12 | https://developers.eveonline.com/ 13 | 14 | ## Options 15 | 16 | The **EVE Online Provider** comes with a set of default options: 17 | 18 | - [EVE Online Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/eveonline.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import EVEOnlineProvider from `next-auth/providers/eveonline` 26 | ... 27 | providers: [ 28 | EVEOnlineProvider({ 29 | clientId: process.env.EVE_CLIENT_ID, 30 | clientSecret: process.env.EVE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip When creating your application, make sure to select `Authentication Only` as the connection type. 37 | 38 | :::tip If using JWT for the session, you can add the `CharacterID` to the JWT token and session. Example: 39 | 40 | ```js 41 | ... 42 | options: { 43 | jwt: { 44 | secret: process.env.JWT_SECRET, 45 | }, 46 | callbacks: { 47 | session: async ({ session, token }) => { 48 | session.user.id = token.id; 49 | return session; 50 | } 51 | } 52 | } 53 | ... 54 | ``` 55 | -------------------------------------------------------------------------------- /docs/providers/facebook.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: facebook 3 | title: Facebook 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ 9 | 10 | ## Configuration 11 | 12 | https://developers.facebook.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Facebook Provider** comes with a set of default options: 17 | 18 | - [Facebook Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/facebook.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import FacebookProvider from `next-auth/providers/facebook` 26 | ... 27 | providers: [ 28 | FacebookProvider({ 29 | clientId: process.env.FACEBOOK_CLIENT_ID, 30 | clientSecret: process.env.FACEBOOK_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | 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. 38 | ::: 39 | 40 | :::tip 41 | Email address may not be returned for accounts created on mobile. 42 | ::: 43 | -------------------------------------------------------------------------------- /docs/providers/faceit.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: faceit 3 | title: FACEIT 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf 9 | 10 | ## Configuration 11 | 12 | https://developers.faceit.com/apps 13 | 14 | Grant type: `Authorization Code` 15 | 16 | Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile` 17 | 18 | ## Options 19 | 20 | The **FACEIT Provider** comes with a set of default options: 21 | 22 | - [FACEIT Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/faceit.js) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import FaceItProvider from `next-auth/providers/faceit` 30 | ... 31 | providers: [ 32 | FaceItProvider({ 33 | clientId: process.env.FACEIT_CLIENT_ID, 34 | clientSecret: process.env.FACEIT_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/providers/foursquare.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: foursquare 3 | title: Foursquare 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.foursquare.com/docs/places-api/authentication/#web-applications 9 | 10 | ## Configuration 11 | 12 | https://developer.foursquare.com/ 13 | 14 | :::warning 15 | 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". 16 | ::: 17 | 18 | ## Options 19 | 20 | The **Foursquare Provider** comes with a set of default options: 21 | 22 | - [Foursquare Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/foursquare.js) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import FourSquareProvider from `next-auth/providers/foursquare` 30 | ... 31 | providers: [ 32 | FourSquareProvider({ 33 | clientId: process.env.FOURSQUARE_CLIENT_ID, 34 | clientSecret: process.env.FOURSQUARE_CLIENT_SECRET, 35 | apiVersion: 'YYYYMMDD' 36 | }) 37 | ] 38 | ... 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/providers/freshbooks.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: freshbooks 3 | title: Freshbooks 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.freshbooks.com/api/authenticating-with-oauth-2-0-on-the-new-freshbooks-api 9 | 10 | ## Configuration 11 | 12 | https://my.freshbooks.com/#/developer 13 | 14 | ## Options 15 | 16 | The Freshbooks Provider comes with a set of default options: 17 | 18 | https://www.freshbooks.com/api/start 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import FreshbooksProvider from `next-auth/providers/freshbooks` 26 | ... 27 | providers: [ 28 | FreshbooksProvider({ 29 | clientId: process.env.FRESHBOOKS_CLIENT_ID, 30 | clientSecret: process.env.FRESHBOOKS_CLIENT_SECRET, 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/fusionauth.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fusionauth 3 | title: FusionAuth 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://fusionauth.io/docs/v1/tech/oauth/ 9 | 10 | ## Options 11 | 12 | The **FusionAuth Provider** comes with a set of default options: 13 | 14 | - [FusionAuth Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/fusionauth.ts) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import FusionAuthProvider from `next-auth/providers/fusionauth` 22 | ... 23 | providers: [ 24 | FusionAuthProvider({ 25 | id: "fusionauth", 26 | name: "FusionAuth", 27 | issuer: process.env.FUSIONAUTH_ISSUER, 28 | clientId: process.env.FUSIONAUTH_CLIENT_ID, 29 | clientSecret: process.env.FUSIONAUTH_SECRET, 30 | tenantId: process.env.FUSIONAUTH_TENANT_ID // Only required if you're using multi-tenancy 31 | }), 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | If you're using multi-tenancy, you need to pass in the `tenantId` option to apply the proper theme. 38 | ::: 39 | 40 | ## Instructions 41 | 42 | ### Configuration 43 | 44 | :::tip 45 | An application can be created at https://your-fusionauth-server-url/admin/application. 46 | 47 | For more information, follow the [FusionAuth 5-minute setup guide](https://fusionauth.io/docs/v1/tech/5-minute-setup-guide). 48 | ::: 49 | 50 | In the OAuth settings for your application, configure the following. 51 | 52 | - Redirect URL 53 | - https://localhost:3000/api/auth/callback/fusionauth 54 | - Enabled grants 55 | - Make sure _Authorization Code_ is enabled. 56 | 57 | If using JSON Web Tokens, you need to make sure the signing algorithm is RS256, you can create an RS256 key pair by 58 | going to Settings, Key Master, generate RSA and choosing SHA-256 as algorithm. After that, go to the JWT settings of 59 | your application and select this key as Access Token signing key and Id Token signing key. 60 | -------------------------------------------------------------------------------- /docs/providers/github.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: github 3 | title: GitHub 4 | --- 5 | 6 | :::note 7 | GitHub returns a field on `Account` called `refresh_token_expires_in` which is a number. See their [docs](https://docs.github.com/en/developers/apps/building-github-apps/refreshing-user-to-server-access-tokens#response). Remember to add this field to your database schema, in case if you are using an [Adapter](/adapters/overview). 8 | ::: 9 | 10 | 11 | ## Documentation 12 | 13 | https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps 14 | 15 | ## Configuration 16 | 17 | https://github.com/settings/apps 18 | 19 | ## Options 20 | 21 | The **GitHub Provider** comes with a set of default options: 22 | 23 | - [GitHub Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/github.js) 24 | 25 | You can override any of the options to suit your own use case. 26 | 27 | ## Example 28 | 29 | ```js 30 | import GitHubProvider from `next-auth/providers/github` 31 | ... 32 | providers: [ 33 | GitHubProvider({ 34 | clientId: process.env.GITHUB_CLIENT_ID, 35 | clientSecret: process.env.GITHUB_CLIENT_SECRET 36 | }) 37 | ] 38 | ... 39 | ``` 40 | 41 | :::warning 42 | Only allows one callback URL per Client ID / Client Secret. 43 | ::: 44 | 45 | :::tip 46 | Email address is always returned, even if the user doesn't have a public email address on their profile. 47 | ::: 48 | -------------------------------------------------------------------------------- /docs/providers/gitlab.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: gitlab 3 | title: GitLab 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.gitlab.com/ee/api/oauth2.html 9 | 10 | ## Configuration 11 | 12 | https://gitlab.com/-/profile/applications 13 | 14 | ## Options 15 | 16 | The **Gitlab Provider** comes with a set of default options: 17 | 18 | - [Gitlab Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/gitlab.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import GitlabProvider from `next-auth/providers/gitlab` 26 | ... 27 | providers: [ 28 | GitlabProvider({ 29 | clientId: process.env.GITLAB_CLIENT_ID, 30 | clientSecret: process.env.GITLAB_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | Enable the _"read_user"_ option in scope if you want to save the users email address on sign up. 38 | ::: 39 | -------------------------------------------------------------------------------- /docs/providers/google.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: google 3 | title: Google 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.google.com/identity/protocols/oauth2 9 | 10 | ## Configuration 11 | 12 | https://console.developers.google.com/apis/credentials 13 | 14 | ## Options 15 | 16 | The **Google Provider** comes with a set of default options: 17 | 18 | - [Google Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/google.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import GoogleProvider from `next-auth/providers/google` 26 | ... 27 | providers: [ 28 | GoogleProvider({ 29 | clientId: process.env.GOOGLE_CLIENT_ID, 30 | clientSecret: process.env.GOOGLE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Google only provides Refresh Token to an application the first time a user signs in. 38 | 39 | To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again: 40 | https://myaccount.google.com/permissions 41 | 42 | Alternatively, you can also pass options in the `params` object of `authorization` 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. 43 | 44 | 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. 45 | 46 | ```js 47 | const options = { 48 | ... 49 | providers: [ 50 | GoogleProvider({ 51 | clientId: process.env.GOOGLE_ID, 52 | clientSecret: process.env.GOOGLE_SECRET, 53 | authorization: { 54 | params: { 55 | prompt: "consent", 56 | access_type: "offline", 57 | response_type: "code" 58 | } 59 | } 60 | }) 61 | ], 62 | ... 63 | } 64 | ``` 65 | 66 | ::: 67 | 68 | :::tip 69 | Google also returns a `email_verified` boolean property in the OAuth profile. 70 | 71 | You can use this property to restrict access to people with verified accounts at a particular domain. 72 | 73 | ```js 74 | const options = { 75 | ... 76 | callbacks: { 77 | async signIn({ account, profile }) { 78 | if (account.provider === "google") { 79 | return profile.email_verified && profile.email.endsWith('@example.com') 80 | } 81 | return true // Do different verification for other providers that don't have `email_verified` 82 | }, 83 | } 84 | ... 85 | } 86 | ``` 87 | 88 | ::: 89 | -------------------------------------------------------------------------------- /docs/providers/identity-server4.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: identity-server4 3 | title: IdentityServer4 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://identityserver4.readthedocs.io/en/latest/ 9 | 10 | ## Options 11 | 12 | The **IdentityServer4 Provider** comes with a set of default options: 13 | 14 | - [IdentityServer4 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/identity-server4.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import IdentityServer4Provider from `next-auth/providers/identity-server4` 22 | ... 23 | providers: [ 24 | IdentityServer4Provider({ 25 | id: "identity-server4", 26 | name: "IdentityServer4", 27 | issuer: process.env.IdentityServer4_Issuer, 28 | clientId: process.env.IdentityServer4_CLIENT_ID, 29 | clientSecret: process.env.IdentityServer4_CLIENT_SECRET 30 | }) 31 | ] 32 | ... 33 | ``` 34 | 35 | ## Demo IdentityServer 36 | 37 | The configuration below is for the demo server at https://demo.identityserver.io/ 38 | 39 | If you want to try it out, you can copy and paste the configuration below. 40 | 41 | You can sign in to the demo service with either bob/bob or alice/alice. 42 | 43 | ```js 44 | import IdentityServer4Provider from `next-auth/providers/identity-server4` 45 | ... 46 | providers: [ 47 | IdentityServer4Provider({ 48 | id: "demo-identity-server", 49 | name: "Demo IdentityServer4", 50 | authorization: { params: { scope: "openid profile email api offline_access" } }, 51 | issuer: "https://demo.identityserver.io/", 52 | clientId: "interactive.confidential", 53 | clientSecret: "secret", 54 | }) 55 | } 56 | ... 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/providers/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: overview 3 | title: Overview 4 | --- 5 | 6 | Authentication Providers in **NextAuth.js** are services that can be used to sign in a user. 7 | 8 | There's four ways a user can be signed in: 9 | 10 | - [Using a built-in OAuth Provider](/configuration/providers/oauth) (e.g Github, Twitter, Google, etc...) 11 | - [Using a custom OAuth Provider](/configuration/providers/oauth#using-a-custom-provider) 12 | - [Using Email](/configuration/providers/email) 13 | - [Using Credentials](/configuration/providers/credentials) 14 | 15 | :::note 16 | NextAuth.js is designed to work with any OAuth service, it supports **OAuth 1.0**, **1.0A**, **2.0** and **OpenID Connect (OIDC)** and has built-in support for most popular sign-in services. 17 | ::: 18 | -------------------------------------------------------------------------------- /docs/providers/instagram.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: instagram 3 | title: Instagram 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.facebook.com/docs/instagram-basic-display-api/getting-started 9 | 10 | ## Configuration 11 | 12 | https://developers.facebook.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Instagram Provider** comes with a set of default options: 17 | 18 | - [Instagram Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/instagram.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```jsx 25 | // pages/api/auth/[...nextauth].js 26 | import InstagramProvider from `next-auth/providers/instagram` 27 | ... 28 | providers: [ 29 | InstagramProvider({ 30 | clientId: process.env.INSTAGRAM_CLIENT_ID, 31 | clientSecret: process.env.INSTAGRAM_CLIENT_SECRET 32 | }) 33 | ] 34 | ... 35 | // pages/index.jsx 36 | import { signIn } from "next-auth/react" 37 | ... 38 | 41 | ... 42 | ``` 43 | 44 | :::warning 45 | Email address is not returned by the Instagram API. 46 | ::: 47 | 48 | :::tip 49 | 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). 50 | ::: 51 | -------------------------------------------------------------------------------- /docs/providers/kakao.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: kakao 3 | title: Kakao 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.kakao.com/product/kakaoLogin 9 | 10 | ## Configuration 11 | 12 | https://developers.kakao.com/docs/latest/en/kakaologin/common 13 | 14 | ## Options 15 | 16 | The **Kakao Provider** comes with a set of default options: 17 | 18 | - [Kakao Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/kakao.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import KakaoProvider from `next-auth/providers/kakao` 26 | ... 27 | providers: [ 28 | KakaoProvider({ 29 | clientId: process.env.KAKAO_CLIENT_ID, 30 | clientSecret: process.env.KAKAO_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | ## Instructions 37 | 38 | ### Configuration 39 | 40 | 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. 41 | -------------------------------------------------------------------------------- /docs/providers/keycloak.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: keycloak 3 | title: Keycloak 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients 9 | 10 | ## Configuration 11 | 12 | :::tip 13 | Create an openid-connect client in Keycloak with "confidential" as the "Access Type". 14 | ::: 15 | 16 | ## Options 17 | 18 | The **Keycloak Provider** comes with a set of default options: 19 | 20 | - [Keycloak Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/keycloak.ts) 21 | 22 | You can override any of the options to suit your own use case. 23 | 24 | ## Example 25 | 26 | ```js 27 | import KeycloakProvider from `next-auth/providers/keycloak` 28 | ... 29 | providers: [ 30 | KeycloakProvider({ 31 | clientId: process.env.KEYCLOAK_ID, 32 | clientSecret: process.env.KEYCLOAK_SECRET, 33 | issuer: process.env.KEYCLOAK_ISSUER, 34 | }) 35 | ] 36 | ... 37 | ``` 38 | 39 | :::note 40 | `issuer` should include the realm – e.g. `https://my-keycloak-domain.com/auth/realms/My_Realm` 41 | ::: 42 | -------------------------------------------------------------------------------- /docs/providers/line.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: line 3 | title: LINE 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.line.biz/en/docs/line-login/integrate-line-login/ 9 | 10 | ## Configuration 11 | 12 | https://developers.line.biz/console/ 13 | 14 | ## Options 15 | 16 | The **Line Provider** comes with a set of default options: 17 | 18 | - [Line Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/line.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import LineProvider from `next-auth/providers/line` 26 | ... 27 | providers: [ 28 | LineProvider({ 29 | clientId: process.env.LINE_CLIENT_ID, 30 | clientSecret: process.env.LINE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | ## Instructions 37 | 38 | ### Configuration 39 | 40 | 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: 41 | 42 | - Callback URL 43 | - http://localhost:3000/api/auth/callback/line 44 | 45 | :::tip 46 | To retrieve email address, you need to apply for Email address permission. Open [Line Developer Console](https://developers.line.biz/console/), go to your Login Channel. Scroll down bottom to find **OpenID Connect** -> **Email address permission**. Click **Apply** and follow the instruction. 47 | ::: 48 | -------------------------------------------------------------------------------- /docs/providers/linkedin.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: linkedin 3 | title: LinkedIn 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow 9 | 10 | ## Configuration 11 | 12 | https://www.linkedin.com/developers/apps/ 13 | 14 | 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. 15 | 16 | ![image](https://user-images.githubusercontent.com/330396/114429603-68195600-9b72-11eb-8311-62e58383c42b.png) 17 | 18 | ## Options 19 | 20 | The **LinkedIn Provider** comes with a set of default options: 21 | 22 | - [LinkedIn Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/linkedin.ts) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import LinkedInProvider from `next-auth/providers/linkedin` 30 | ... 31 | providers: [ 32 | LinkedInProvider({ 33 | clientId: process.env.LINKEDIN_CLIENT_ID, 34 | clientSecret: process.env.LINKEDIN_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/providers/mailchimp.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mailchimp 3 | title: Mailchimp 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ 9 | 10 | ## Configuration 11 | 12 | https://admin.mailchimp.com/account/oauth2/client/ 13 | 14 | ## Options 15 | 16 | The **Mailchimp Provider** comes with a set of default options: 17 | 18 | - [Mailchimp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailchimp.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import MailchimpProvider from `next-auth/providers/mailchimp` 26 | ... 27 | providers: [ 28 | MailchimpProvider({ 29 | clientId: process.env.MAILCHIMP_CLIENT_ID, 30 | clientSecret: process.env.MAILCHIMP_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/mailru.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mailru 3 | title: Mail.ru 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://o2.mail.ru/docs 9 | 10 | ## Configuration 11 | 12 | https://o2.mail.ru/app/ 13 | 14 | ## Options 15 | 16 | The **Mail.ru Provider** comes with a set of default options: 17 | 18 | - [Mail.ru Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailru.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import MailRuProvider from `next-auth/providers/mailru` 26 | ... 27 | providers: [ 28 | MailRuProvider({ 29 | clientId: process.env.MAILRU_CLIENT_ID, 30 | clientSecret: process.env.MAILRU_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/medium.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: medium 3 | title: Medium 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://github.com/Medium/medium-api-docs 9 | 10 | ## Configuration 11 | 12 | https://medium.com/me/applications 13 | 14 | ## Options 15 | 16 | The **Medium Provider** comes with a set of default options: 17 | 18 | - [Medium Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/medium.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import MediumProvider from `next-auth/providers/medium` 26 | ... 27 | providers: [ 28 | MediumProvider({ 29 | clientId: process.env.MEDIUM_CLIENT_ID, 30 | clientSecret: process.env.MEDIUM_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Email address is not returned by the Medium API. 38 | ::: 39 | -------------------------------------------------------------------------------- /docs/providers/naver.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: naver 3 | title: Naver 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.naver.com/docs/login/overview/overview.md 9 | 10 | ## Configuration 11 | 12 | https://developers.naver.com/docs/login/api/api.md 13 | 14 | ## Options 15 | 16 | The **Naver Provider** comes with a set of default options: 17 | 18 | - [Naver Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/naver.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import NaverProvider from `next-auth/providers/naver` 26 | ... 27 | providers: [ 28 | NaverProvider({ 29 | clientId: process.env.NAVER_CLIENT_ID, 30 | clientSecret: process.env.NAVER_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/netlify.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: netlify 3 | title: Netlify 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.netlify.com/blog/2016/10/10/integrating-with-netlify-oauth2/ 9 | 10 | ## Configuration 11 | 12 | https://github.com/netlify/netlify-oauth-example 13 | 14 | ## Options 15 | 16 | The **Netlify Provider** comes with a set of default options: 17 | 18 | - [Netlify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/netlify.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import NetlifyProvider from `next-auth/providers/netlify` 26 | ... 27 | providers: [ 28 | NetlifyProvider({ 29 | clientId: process.env.NETLIFY_CLIENT_ID, 30 | clientSecret: process.env.NETLIFY_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/okta.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: okta 3 | title: Okta 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.okta.com/docs/reference/api/oidc 9 | 10 | ## Options 11 | 12 | The **Okta Provider** comes with a set of default options: 13 | 14 | - [Okta Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/okta.ts) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import OktaProvider from `next-auth/providers/okta` 22 | ... 23 | providers: [ 24 | OktaProvider({ 25 | clientId: process.env.OKTA_CLIENT_ID, 26 | clientSecret: process.env.OKTA_CLIENT_SECRET, 27 | issuer: process.env.OKTA_ISSUER 28 | }) 29 | ] 30 | ... 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/providers/onelogin.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: onelogin 3 | title: OneLogin 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.onelogin.com/openid-connect 9 | 10 | ## Configuration 11 | 12 | https://developers.onelogin.com/openid-connect/connect-to-onelogin 13 | 14 | ## Options 15 | 16 | The **OneLogin Provider** comes with a set of default options: 17 | 18 | - [OneLogin Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/onelogin.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import OneLoginProvider from `next-auth/providers/onelogin` 26 | ... 27 | providers: [ 28 | OneLoginProvider({ 29 | clientId: process.env.ONELOGIN_CLIENT_ID, 30 | clientSecret: process.env.ONELOGIN_CLIENT_SECRET, 31 | issuer: process.env.ONELOGIN_ISSUER 32 | }) 33 | ] 34 | ... 35 | ``` 36 | -------------------------------------------------------------------------------- /docs/providers/osso.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: osso 3 | title: Osso 4 | --- 5 | 6 | ## Documentation 7 | 8 | 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. 9 | 10 | 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/ 11 | 12 | ## Configuration 13 | 14 | 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. 15 | 16 | [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. 17 | 18 | See Osso's complete configuration and testing documentation at https://ossoapp.com/docs/configure/overview 19 | 20 | ## Options 21 | 22 | The **Osso Provider** comes with a set of default options: 23 | 24 | - [Osso Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/osso.js) 25 | 26 | You can override any of the options to suit your own use case. 27 | 28 | ## Example 29 | 30 | A full example application is available at https://github.com/enterprise-oss/osso-next-auth-example and https://nextjs-demo.ossoapp.com 31 | 32 | ```js 33 | import OssoProvider from `next-auth/providers/osso` 34 | ... 35 | providers: [ 36 | OssoProvider({ 37 | clientId: process.env.OSSO_CLIENT_ID, 38 | clientSecret: process.env.OSSO_CLIENT_SECRET, 39 | issuer: process.env.OSSO_ISSUER 40 | }) 41 | } 42 | ... 43 | ``` 44 | 45 | :::note 46 | `issuer` should be the fully qualified domain – e.g. `demo.ossoapp.com` 47 | ::: 48 | -------------------------------------------------------------------------------- /docs/providers/osu.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: osu 3 | title: Osu! 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://osu.ppy.sh/docs/index.html#authentication 9 | 10 | ## Configuration 11 | 12 | https://osu.ppy.sh/home/account/edit#new-oauth-application 13 | 14 | ## Options 15 | 16 | The **Osu Provider** comes with a set of default options: 17 | 18 | - [Osu Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/osu.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | 23 | :::note 24 | Osu! does **not** provide a user email! 25 | ::: 26 | 27 | 28 | ## Example 29 | 30 | ```js 31 | import OsuProvider from `next-auth/providers/osu` 32 | ... 33 | providers: [ 34 | OsuProvider({ 35 | clientId: process.env.OSU_CLIENT_ID, 36 | clientSecret: process.env.OSU_CLIENT_SECRET 37 | }) 38 | ] 39 | ... 40 | ``` 41 | -------------------------------------------------------------------------------- /docs/providers/pipedrive.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: pipedrive 3 | title: Pipedrive 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://pipedrive.readme.io/docs/marketplace-oauth-authorization 9 | 10 | ## Options 11 | 12 | The **Pipedrive Provider** comes with a set of default options: 13 | 14 | - [Pipedrive Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/pipedrive.ts) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import PipedriveProvider from 'next-auth/providers/pipedrive' 22 | ... 23 | providers: [ 24 | PipedriveProvider({ 25 | clientId: process.env.PIPEDRIVE_CLIENT_ID, 26 | clientSecret: process.env.PIPEDRIVE_CLIENT_SECRET, 27 | }) 28 | ] 29 | ... 30 | ``` -------------------------------------------------------------------------------- /docs/providers/reddit.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: reddit 3 | title: Reddit 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.reddit.com/dev/api/ 9 | 10 | ## Configuration 11 | 12 | https://www.reddit.com/prefs/apps/ 13 | 14 | ## Options 15 | 16 | The **Reddit Provider** comes with a set of default options: 17 | 18 | - [Reddit Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/reddit.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import RedditProvider from `next-auth/providers/reddit` 26 | ... 27 | providers: [ 28 | RedditProvider({ 29 | clientId: process.env.REDDIT_CLIENT_ID, 30 | clientSecret: process.env.REDDIT_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Reddit requires authorization every time you go through their page. 38 | ::: 39 | 40 | :::warning 41 | Only allows one callback URL per Client ID / Client Secret. 42 | ::: 43 | 44 | :::tip 45 | 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: 46 | 47 | ```js 48 | providers: [ 49 | { 50 | id: "reddit", 51 | name: "Reddit", 52 | clientId: process.env.REDDIT_CLIENT_ID, 53 | clientSecret: process.env.REDDIT_CLIENT_SECRET, 54 | scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required. 55 | type: "oauth", 56 | version: "2.0", 57 | params: { grant_type: "authorization_code" }, 58 | accessTokenUrl: " https://www.reddit.com/api/v1/access_token", 59 | authorizationUrl: 60 | "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent", 61 | profileUrl: "https://oauth.reddit.com/api/v1/me", 62 | profile: (profile) => { 63 | return { 64 | id: profile.id, 65 | name: profile.name, 66 | email: null, 67 | } 68 | }, 69 | }, 70 | ] 71 | ``` 72 | 73 | ::: 74 | -------------------------------------------------------------------------------- /docs/providers/salesforce.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: salesforce 3 | title: Salesforce 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&type=5 9 | 10 | ## Options 11 | 12 | The **Salesforce Provider** comes with a set of default options: 13 | 14 | - [Salesforce Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/salesforce.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import SalesforceProvider from `next-auth/providers/salesforce` 22 | ... 23 | providers: [ 24 | SalesforceProvider({ 25 | clientId: process.env.SALESFORCE_CLIENT_ID, 26 | clientSecret: process.env.SALESFORCE_CLIENT_SECRET, 27 | }) 28 | ] 29 | ... 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/providers/slack.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: slack 3 | title: Slack 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://api.slack.com/authentication 9 | https://api.slack.com/docs/sign-in-with-slack 10 | 11 | ## Configuration 12 | 13 | https://api.slack.com/apps 14 | 15 | :::warning 16 | Slack requires you that the redirect URL of your app uses `https`, even for local development. An easy workaround for this is using a service like [`ngrok`](https://ngrok.com) that creates a secure tunnel to your app, using `https`. Remember to set the url as `NEXTAUTH_URL` as well. 17 | ::: 18 | 19 | ![](https://i.imgur.com/ydYKTLD.png) 20 | 21 | ## Options 22 | 23 | The **Slack Provider** comes with a set of default options: 24 | 25 | - [Slack Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/slack.ts) 26 | 27 | You can override any of the options to suit your own use case. 28 | 29 | ## Example 30 | 31 | ```js 32 | import SlackProvider from `next-auth/providers/slack` 33 | ... 34 | providers: [ 35 | SlackProvider({ 36 | clientId: process.env.SLACK_CLIENT_ID, 37 | clientSecret: process.env.SLACK_CLIENT_SECRET 38 | }) 39 | ] 40 | ... 41 | ``` 42 | -------------------------------------------------------------------------------- /docs/providers/spotify.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: spotify 3 | title: Spotify 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.spotify.com/documentation/general/guides/authorization-guide 9 | 10 | ## Configuration 11 | 12 | https://developer.spotify.com/dashboard/applications 13 | 14 | ## Options 15 | 16 | The **Spotify Provider** comes with a set of default options: 17 | 18 | - [Spotify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/spotify.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import SpotifyProvider from `next-auth/providers/spotify` 26 | ... 27 | providers: [ 28 | SpotifyProvider({ 29 | clientId: process.env.SPOTIFY_CLIENT_ID, 30 | clientSecret: process.env.SPOTIFY_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/strava.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: strava 3 | title: Strava 4 | --- 5 | 6 | ## Documentation 7 | 8 | http://developers.strava.com/docs/reference/ 9 | 10 | ## Options 11 | 12 | The **Strava Provider** comes with a set of default options: 13 | 14 | - [Strava Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/strava.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import StravaProvider from 'next-auth/providers/strava' 22 | ... 23 | providers: [ 24 | StravaProvider({ 25 | clientId: process.env.STRAVA_CLIENT_ID, 26 | clientSecret: process.env.STRAVA_CLIENT_SECRET, 27 | }) 28 | ] 29 | ... 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/providers/twitch.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: twitch 3 | title: Twitch 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://dev.twitch.tv/docs/authentication 9 | 10 | ## Configuration 11 | 12 | https://dev.twitch.tv/console/apps 13 | 14 | Add the following redirect URL into the console `http:///api/auth/callback/twitch` 15 | 16 | ## Options 17 | 18 | The **Twitch Provider** comes with a set of default options: 19 | 20 | - [Twitch Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitch.ts) 21 | 22 | You can override any of the options to suit your own use case. 23 | 24 | ## Example 25 | 26 | ```js 27 | import TwitchProvider from `next-auth/providers/twitch` 28 | ... 29 | providers: [ 30 | TwitchProvider({ 31 | clientId: process.env.TWITCH_CLIENT_ID, 32 | clientSecret: process.env.TWITCH_CLIENT_SECRET 33 | }) 34 | ] 35 | ... 36 | ``` 37 | -------------------------------------------------------------------------------- /docs/providers/twitter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: twitter 3 | title: Twitter 4 | --- 5 | 6 | :::note 7 | Twitter is currently the only built-in provider using the OAuth 1.0 spec. This means that you won't receive an `access_token` or `refresh_token`, but an `oauth_token` and `oauth_token_secret` respectively. Remember to add these to your database schema, in case if you are using an [Adapter](/adapters/overview). 8 | ::: 9 | 10 | ## Documentation 11 | 12 | https://developer.twitter.com 13 | 14 | ## Configuration 15 | 16 | https://developer.twitter.com/en/apps 17 | 18 | ## Options 19 | 20 | The **Twitter Provider** comes with a set of default options: 21 | 22 | - [Twitter Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/twitter.ts) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import TwitterProvider from `next-auth/providers/twitter` 30 | ... 31 | providers: [ 32 | TwitterProvider({ 33 | clientId: process.env.TWITTER_CLIENT_ID, 34 | clientSecret: process.env.TWITTER_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | 40 | :::tip 41 | You must enable the _"Request email address from users"_ option in your app permissions if you want to obtain the users email address. 42 | ::: 43 | 44 | ![twitter](https://user-images.githubusercontent.com/7902980/83944068-1640ca80-a801-11ea-959c-0e744e2144f7.PNG) 45 | -------------------------------------------------------------------------------- /docs/providers/vk.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: vk 3 | title: VK 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://vk.com/dev/first_guide 9 | 10 | ## Configuration 11 | 12 | https://vk.com/apps?act=manage 13 | 14 | ## Options 15 | 16 | The **VK Provider** comes with a set of default options: 17 | 18 | - [VK Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/vk.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import VkProvider from `next-auth/providers/vk` 26 | ... 27 | providers: [ 28 | VkProvider({ 29 | clientId: process.env.VK_CLIENT_ID, 30 | clientSecret: process.env.VK_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::note 37 | By default the provider uses `5.126` version of the API. See https://vk.com/dev/versions for more info. 38 | ::: 39 | 40 | If you want to use a different version, you can pass it to provider's options object: 41 | 42 | ```js 43 | // pages/api/auth/[...nextauth].js 44 | 45 | const apiVersion = "5.126" 46 | ... 47 | providers: [ 48 | VkProvider({ 49 | accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, 50 | requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, 51 | authorizationUrl: 52 | `https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`, 53 | profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`, 54 | }) 55 | ] 56 | ... 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/providers/wordpress.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: wordpress 3 | title: WordPress.com 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.wordpress.com/docs/oauth2/ 9 | 10 | ## Configuration 11 | 12 | https://developer.wordpress.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Wordpress Provider** comes with a set of default options: 17 | 18 | - [Wordpress Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/wordpress.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import WordpressProvider from `next-auth/providers/wordpress` 26 | ... 27 | providers: [ 28 | WordpressProvider({ 29 | clientId: process.env.WORDPRESS_CLIENT_ID, 30 | clientSecret: process.env.WORDPRESS_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | 36 | :::tip 37 | 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. 38 | ::: 39 | -------------------------------------------------------------------------------- /docs/providers/yandex.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: yandex 3 | title: Yandex 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://tech.yandex.com/oauth/doc/dg/concepts/about-docpage/ 9 | 10 | ## Configuration 11 | 12 | https://oauth.yandex.com/client/new 13 | 14 | ## Options 15 | 16 | The **Yandex Provider** comes with a set of default options: 17 | 18 | - [Yandex Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/yandex.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import YandexProvider from `next-auth/providers/yandex` 26 | ... 27 | providers: [ 28 | YandexProvider({ 29 | clientId: process.env.YANDEX_CLIENT_ID, 30 | clientSecret: process.env.YANDEX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/zoho.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: zoho 3 | title: Zoho 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.zoho.com/accounts/protocol/oauth/web-server-applications.html 9 | 10 | ## Configuration 11 | 12 | https://api-console.zoho.com/ 13 | 14 | ## Options 15 | 16 | The **Zoho Provider** comes with a set of default options: 17 | 18 | - [Zoho Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoho.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import ZohoProvider from `next-auth/providers/zoho` 26 | ... 27 | providers: [ 28 | ZohoProvider({ 29 | clientId: process.env.ZOHO_CLIENT_ID, 30 | clientSecret: process.env.ZOHO_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/providers/zoom.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: zoom 3 | title: Zoom 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://marketplace.zoom.us/docs/guides/auth/oauth 9 | 10 | ## Configuration 11 | 12 | https://marketplace.zoom.us 13 | 14 | ## Options 15 | 16 | The **Zoom Provider** comes with a set of default options: 17 | 18 | - [Zoom Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoom.ts) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import ZoomProvider from `next-auth/providers/zoom` 26 | ... 27 | providers: [ 28 | ZoomProvider({ 29 | clientId: process.env.ZOOM_CLIENT_ID, 30 | clientSecret: process.env.ZOOM_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/security.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: security 3 | title: Security 4 | --- 5 | 6 | ## Reporting a Vulnerability 7 | 8 | NextAuth.js practices responsible disclosure. 9 | 10 | We request that you contact us directly to report serious issues that might impact the security of sites using NextAuth.js. 11 | 12 | If you contact us regarding a serious issue: 13 | 14 | - We will endeavor to get back to you within 72 hours. 15 | - We will aim to publish a fix within 30 days. 16 | - We will disclose the issue (and credit you, with your consent) once a fix to resolve the issue has been released. 17 | - If 90 days has elapsed and we still don't have a fix, we will disclose the issue publicly. 18 | 19 | The best way to report an issue is by contacting us via email at info@balazsorban.com or me@iaincollins.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. (Please do not disclose sensitive details publicly at this stage.) 20 | 21 | :::note 22 | For less serious issues (e.g. RFC compliance for unsupported flows or potential issues that may cause a problem in the future) it is appropriate to submit these these publically as bug reports or feature requests or to raise a question to open a discussion around them. 23 | ::: 24 | 25 | ## Supported Versions 26 | 27 | Security updates are only released for the current version. 28 | 29 | Old releases are not maintained and do not receive updates. 30 | -------------------------------------------------------------------------------- /docs/tutorials/creating-a-database-adapter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: creating-a-database-adapter 3 | title: Create an adapter 4 | --- 5 | 6 | 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. 7 | 8 | ## How to create an adapter 9 | 10 | _See the code below for practical example._ 11 | 12 | ### Example code 13 | 14 | ```ts 15 | /** @return { import("next-auth/adapters").Adapter } */ 16 | export default function MyAdapter(client, options = {}) { 17 | return { 18 | async createUser(user) { 19 | return 20 | }, 21 | async getUser(id) { 22 | return 23 | }, 24 | async getUserByEmail(email) { 25 | return 26 | }, 27 | async getUserByAccount({ provider, id }) { 28 | return 29 | }, 30 | async updateUser(user) { 31 | return 32 | }, 33 | async deleteUser(userId) { 34 | return 35 | }, 36 | async linkAccount(account) { 37 | return 38 | }, 39 | async unlinkAccount({ provider, id }) { 40 | return 41 | }, 42 | async createSession({ sessionToken, userId, expires }) { 43 | return 44 | }, 45 | async getSessionAndUser(sessionToken) { 46 | return 47 | }, 48 | async updateSession({ sessionToken }) { 49 | return 50 | }, 51 | async deleteSession(sessionToken) { 52 | return 53 | }, 54 | async createVerificationToken({ identifier, expires, token }) { 55 | return 56 | }, 57 | async useVerificationToken({ identifier, token }) { 58 | return 59 | }, 60 | } 61 | } 62 | ``` 63 | 64 | ### Required methods 65 | 66 | These methods are required for all sign in flows: 67 | 68 | - `createUser` 69 | - `getUser` 70 | - `getUserByEmail` 71 | - `getUserByAccount` 72 | - `linkAccount` 73 | - `createSession` 74 | - `getSessionAndUser` 75 | - `updateSession` 76 | - `deleteSession` 77 | - `updateUser` 78 | 79 | These methods are required to support email / passwordless sign in: 80 | 81 | - `createVerificationToken` 82 | - `useVerificationToken` 83 | 84 | ### Unimplemented methods 85 | 86 | These methods will be required in a future release, but are not yet invoked: 87 | 88 | - `deleteUser` 89 | - `unlinkAccount` 90 | -------------------------------------------------------------------------------- /docs/tutorials/usage-with-class-components.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: usage-with-class-components 3 | title: Usage with class components 4 | --- 5 | 6 | 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. 7 | 8 | ## Higher Order Component 9 | 10 | ```js 11 | import { useSession } from "next-auth/react" 12 | 13 | const withSession = (Component) => (props) => { 14 | const session = useSession() 15 | 16 | // if the component has a render property, we are good 17 | if (Component.prototype.render) { 18 | return 19 | } 20 | 21 | // if the passed component is a function component, there is no need for this wrapper 22 | throw new Error( 23 | [ 24 | "You passed a function component, `withSession` is not needed.", 25 | "You can `useSession` directly in your component.", 26 | ].join("\n") 27 | ) 28 | } 29 | 30 | // Usage 31 | class ClassComponent extends React.Component { 32 | render() { 33 | const { data: session, status } = this.props.session 34 | return null 35 | } 36 | } 37 | 38 | const ClassComponentWithSession = withSession(ClassComponent) 39 | ``` 40 | 41 | ## Render Prop 42 | 43 | ```js 44 | import { useSession } from "next-auth/react" 45 | 46 | const UseSession = ({ children }) => { 47 | const session = useSession() 48 | return children(session) 49 | } 50 | 51 | // Usage 52 | class ClassComponent extends React.Component { 53 | render() { 54 | return ( 55 | 56 | {(session) =>
{JSON.stringify(session, null, 2)}
} 57 |
58 | ) 59 | } 60 | } 61 | ``` 62 | -------------------------------------------------------------------------------- /docs/warnings.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: warnings 3 | title: Warnings 4 | --- 5 | 6 | This is a list of warning output from NextAuth.js. 7 | 8 | All warnings indicate things which you should take a look at, but do not inhibit normal operation. 9 | 10 | --- 11 | 12 | ## Client 13 | 14 | #### NEXTAUTH_URL 15 | 16 | Environment variable `NEXTAUTH_URL` missing. Please set it in your `.env` file. 17 | 18 | :::note 19 | On [Vercel](https://vercel.com) deployments, we will read the `VERCEL_URL` environment variable, so you won't need to define `NEXTAUTH_URL`. 20 | ::: 21 | 22 | --- 23 | 24 | ## Server 25 | 26 | These warnings are displayed on the terminal. 27 | 28 | #### NO_SECRET 29 | 30 | In development, we generate a `secret` based on your configuration for convenience. This is volatile and will throw an error in production. [Read more](https://next-auth.js.org/configuration/options#secret) 31 | 32 | ## Adapter 33 | 34 | ### ADAPTER_TYPEORM_UPDATING_ENTITIES 35 | 36 | This warning occurs when typeorm finds that the provided entities differ from the database entities. By default while not in `production` the typeorm adapter will always synchronize changes made to the entities codefiles. 37 | 38 | Disable this warning by setting `synchronize: false` in your typeorm config 39 | 40 | Example: 41 | 42 | ```js title="/pages/api/auth/[...nextauth].js" 43 | adapter: TypeORMLegacyAdapter({ 44 | type: 'mysql', 45 | username: process.env.DATABASE_USERNAME, 46 | password: process.env.DATABASE_PASSWORD, 47 | host: process.env.DATABASE_HOST, 48 | database: process.env.DATABASE_DB, 49 | synchronize: false 50 | }), 51 | ``` 52 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-auth-docs", 3 | "version": "0.2.0", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/nextauthjs/docs.git" 7 | }, 8 | "scripts": { 9 | "start": "npm run generate-providers && docusaurus start", 10 | "dev": "npm run start", 11 | "build": "npm run generate-providers && docusaurus build", 12 | "docusaurus": "docusaurus", 13 | "swizzle": "docusaurus swizzle", 14 | "deploy": "docusaurus deploy", 15 | "serve": "docusaurus serve", 16 | "clear": "docusaurus clear", 17 | "lint": "standard", 18 | "lint:fix": "standard --fix", 19 | "generate-providers": "node ./scripts/generate-providers.js" 20 | }, 21 | "dependencies": { 22 | "@docusaurus/core": "2.0.0-beta.9", 23 | "@docusaurus/preset-classic": "2.0.0-beta.9", 24 | "@docusaurus/remark-plugin-npm2yarn": "^2.0.0-beta.9", 25 | "classnames": "^2.3.1", 26 | "lodash.times": "^4.3.2", 27 | "react": "^17.0.2", 28 | "react-dom": "^17.0.2", 29 | "react-marquee-slider": "^1.1.5", 30 | "remark-github": "^10.1.0", 31 | "remark-mermaid-dataurl": "^1.0.2", 32 | "styled-components": "^5.3.3" 33 | }, 34 | "browserslist": { 35 | "production": [ 36 | ">0.2%", 37 | "not dead", 38 | "not op_mini all" 39 | ], 40 | "development": [ 41 | "last 1 chrome version", 42 | "last 1 firefox version", 43 | "last 1 safari version" 44 | ] 45 | }, 46 | "prettier": { 47 | "semi": false, 48 | "singleQuote": false 49 | }, 50 | "devDependencies": { 51 | "prettier": "^2.5.0", 52 | "standard": "^16.0.4" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /scripts/generate-providers.js: -------------------------------------------------------------------------------- 1 | const path = require("path") 2 | const fs = require("fs") 3 | 4 | const providersPath = path.join(process.cwd(), "/docs/providers") 5 | 6 | const files = fs.readdirSync(providersPath, "utf8") 7 | 8 | const result = files.reduce((acc, file) => { 9 | if (file === "overview.md") return acc 10 | const provider = fs.readFileSync(path.join(providersPath, file), "utf8") 11 | const { id, title } = provider.match( 12 | /id: (?.+)\ntitle: (?.+)\n/ 13 | ).groups 14 | acc[id] = title 15 | return acc 16 | }, {}) 17 | 18 | fs.writeFileSync( 19 | path.join(process.cwd(), "providers.json"), 20 | JSON.stringify(result, null, 2) 21 | ) 22 | -------------------------------------------------------------------------------- /sidebars.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | docs: [ 3 | { 4 | type: "category", 5 | label: "Getting Started", 6 | collapsed: false, 7 | items: [ 8 | "getting-started/introduction", 9 | "getting-started/example", 10 | "getting-started/client", 11 | "getting-started/rest-api", 12 | "getting-started/typescript", 13 | "getting-started/upgrade-v4", 14 | ], 15 | }, 16 | { 17 | type: "category", 18 | label: "Configuration", 19 | collapsed: true, 20 | items: [ 21 | "configuration/initialization", 22 | "configuration/options", 23 | { 24 | type: "category", 25 | label: "Providers", 26 | collapsed: true, 27 | items: [ 28 | "configuration/providers/oauth", 29 | "configuration/providers/email", 30 | "configuration/providers/credentials", 31 | ], 32 | }, 33 | "configuration/databases", 34 | "configuration/pages", 35 | "configuration/callbacks", 36 | "configuration/events", 37 | ], 38 | }, 39 | { 40 | type: "category", 41 | label: "Providers", 42 | collapsed: true, 43 | items: [ 44 | "providers/overview", 45 | // TODO: Overview included twice due to autogeneration 46 | { 47 | type: "autogenerated", 48 | dirName: "providers", 49 | }, 50 | ], 51 | }, 52 | { 53 | type: "category", 54 | label: "Adapters", 55 | collapsed: true, 56 | items: [ 57 | "adapters/overview", 58 | "adapters/models", 59 | "adapters/prisma", 60 | "adapters/fauna", 61 | "adapters/dynamodb", 62 | "adapters/firebase", 63 | "adapters/pouchdb", 64 | "adapters/mongodb", 65 | "adapters/neo4j", 66 | "adapters/typeorm", 67 | "adapters/sequelize", 68 | "adapters/mikro-orm", 69 | "adapters/dgraph", 70 | ], 71 | }, 72 | "warnings", 73 | "errors", 74 | ], 75 | } 76 | -------------------------------------------------------------------------------- /src/components/ProviderMarquee.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import Marquee, { Motion, randomIntFromInterval } from "react-marquee-slider" 3 | import * as S from "./ProviderMarqueeStyle" 4 | import times from "lodash.times" 5 | 6 | const icons = [ 7 | "/img/providers/apple-black.svg", 8 | "/img/providers/auth0.svg", 9 | "/img/providers/aws-cognito.svg", 10 | "/img/providers/battle.net.svg", 11 | "/img/providers/box.svg", 12 | "/img/providers/facebook-2.svg", 13 | "/img/providers/github-1.svg", 14 | "/img/providers/gitlab.svg", 15 | "/img/providers/google-icon.svg", 16 | "/img/providers/okta-3.svg", 17 | "/img/providers/openid.svg", 18 | "/img/providers/slack.svg", 19 | "/img/providers/spotify.svg", 20 | "/img/providers/twitter.svg", 21 | ] 22 | 23 | const ProviderMarquee = React.memo(({ size }) => { 24 | let scale = 0.4 25 | 26 | if (typeof window !== "undefined") { 27 | const width = window.outerWidth 28 | if (width > 800) { 29 | scale = 0.6 30 | } 31 | 32 | if (width > 1100) { 33 | scale = 0.7 34 | } 35 | 36 | if (width > 1400) { 37 | scale = 0.8 38 | } 39 | } 40 | 41 | return ( 42 | <S.FullWidth> 43 | <S.Height height={500}> 44 | <Marquee 45 | key="1" 46 | velocity={5} 47 | scatterRandomly 48 | minScale={0.5} 49 | resetAfterTries={200} 50 | > 51 | {times(icons.length, Number).map((id) => ( 52 | <Motion 53 | key={`marquee-example-company-${id}`} 54 | initDeg={randomIntFromInterval(0, 360)} 55 | direction={Math.random() > 0.5 ? "clockwise" : "counterclockwise"} 56 | velocity={10} 57 | radius={scale * 70} 58 | > 59 | <S.Company scale={scale}> 60 | <S.Circle scale={scale}> 61 | <S.Logo src={icons[id]} alt="" /> 62 | </S.Circle> 63 | </S.Company> 64 | </Motion> 65 | ))} 66 | </Marquee> 67 | </S.Height> 68 | </S.FullWidth> 69 | ) 70 | }) 71 | 72 | export default ProviderMarquee 73 | -------------------------------------------------------------------------------- /src/components/ProviderMarqueeStyle.js: -------------------------------------------------------------------------------- 1 | import styled from "styled-components" 2 | 3 | export const Circle = styled.div` 4 | position: absolute; 5 | object-position: center center; 6 | will-change: transform, opacity; 7 | width: ${(props) => props.scale * 150}px; 8 | height: ${(props) => props.scale * 150}px; 9 | top: -50%; 10 | left: -50%; 11 | border-radius: 50%; 12 | display: flex; 13 | justify-content: center; 14 | align-items: center; 15 | margin-top: 1rem; 16 | ` 17 | 18 | export const Logo = styled.img` 19 | display: block; 20 | width: 65%; 21 | height: 65%; 22 | filter: grayscale(100%); 23 | opacity: 0.1; 24 | ` 25 | 26 | export const FullWidth = styled.div` 27 | width: 100vw; 28 | position: relative; 29 | left: 50%; 30 | right: 50%; 31 | margin-left: -50vw; 32 | margin-right: -50vw; 33 | ` 34 | 35 | export const Height = styled.div` 36 | position: relative; 37 | width: 100%; 38 | height: ${(props) => (props.height ? props.height + "px" : "auto")}; 39 | ` 40 | 41 | export const Company = styled.div` 42 | position: relative; 43 | width: ${(props) => props.scale * 75}px; 44 | height: ${(props) => props.scale * 75}px; 45 | ` 46 | -------------------------------------------------------------------------------- /src/css/admonitions.css: -------------------------------------------------------------------------------- 1 | .admonition-icon { 2 | margin-right: 0.5rem; 3 | } 4 | 5 | .admonition.admonition-tip, 6 | .admonition.admonition-note, 7 | .admonition.admonition-warning { 8 | background-color: #f9f9f9; 9 | color: #444; 10 | border: none; 11 | border-left: 0.4rem solid #666; 12 | border-radius: 0; 13 | } 14 | 15 | .admonition.admonition-tip a, 16 | .admonition.admonition-note a, 17 | .admonition.admonition-warning a { 18 | color: #444; 19 | } 20 | 21 | .admonition-icon svg { 22 | fill: #444; 23 | } 24 | 25 | .admonition.admonition-note .admonition-icon svg, 26 | .admonition.admonition-note .admonition-heading { 27 | color: #444; 28 | fill: #444; 29 | } 30 | 31 | html[data-theme="dark"] .admonition.admonition-note .admonition-icon svg, 32 | html[data-theme="dark"] .admonition.admonition-note .admonition-heading { 33 | color: #888; 34 | fill: #888; 35 | } 36 | 37 | html[data-theme="dark"] .admonition.admonition-tip, 38 | html[data-theme="dark"] .admonition.admonition-note, 39 | html[data-theme="dark"] .admonition.admonition-warning { 40 | color: #eee; 41 | background-color: #222; 42 | } 43 | 44 | html[data-theme="dark"] .admonition.admonition-tip a, 45 | html[data-theme="dark"] .admonition.admonition-note a, 46 | html[data-theme="dark"] .admonition.admonition-warning a { 47 | color: #eee; 48 | } 49 | 50 | .admonition.admonition-tip { 51 | border-color: var(--ifm-color-info); 52 | } 53 | 54 | .admonition.admonition-tip .admonition-icon svg, 55 | .admonition.admonition-tip .admonition-heading { 56 | color: var(--ifm-color-info); 57 | fill: var(--ifm-color-info); 58 | } 59 | 60 | .admonition.admonition-warning { 61 | border-color: var(--ifm-color-warning); 62 | } 63 | 64 | .admonition.admonition-warning .admonition-icon svg, 65 | .admonition.admonition-warning .admonition-heading { 66 | color: var(--ifm-color-warning); 67 | fill: var(--ifm-color-warning); 68 | } 69 | 70 | .admonition.alert--success { 71 | --ifm-alert-background-color: var(--ifm-background-color); 72 | --ifm-alert-background-color-highlight: #03a7fa10; 73 | --ifm-alert-foreground-color: var(--ifm-color-primary); 74 | --ifm-alert-border-color: var(--ifm-color-success); 75 | } 76 | -------------------------------------------------------------------------------- /src/css/buttons.css: -------------------------------------------------------------------------------- 1 | .button { 2 | border: none; 3 | transition-duration: 0s; 4 | box-shadow: 0 0 2rem rgba(0, 0, 0, 0.1); 5 | filter: brightness(100%); 6 | } 7 | 8 | .button:hover, 9 | .button:active { 10 | filter: brightness(105%); 11 | } 12 | 13 | html[data-theme="dark"] .button:hover, 14 | html[data-theme="dark"] .button:active { 15 | filter: brightness(105%); 16 | } 17 | 18 | .button--primary, 19 | .button--primary:hover { 20 | background: linear-gradient(0deg, #1786fb 0%, #2cfefe 100%) !important; 21 | color: #fff; 22 | } 23 | 24 | .button.button--secondary.button--outline, 25 | .button.button--secondary.button--outline:link, 26 | .button.button--secondary.button--outline:visited, 27 | .button.button--secondary.button--outline:hover, 28 | .button.button--secondary.button--outline:active { 29 | background: linear-gradient(0deg, #eeeeee 0%, #ffffff 100%) !important; 30 | background: #fff !important; 31 | color: #222 !important; 32 | } 33 | 34 | html[data-theme="dark"] .button.button--secondary.button--outline { 35 | background: linear-gradient(0deg, #000000 0%, #222222 100%) !important; 36 | background: #111 !important; 37 | color: #eee !important; 38 | } 39 | -------------------------------------------------------------------------------- /src/css/navbar.css: -------------------------------------------------------------------------------- 1 | .navbar { 2 | box-shadow: none; 3 | } 4 | 5 | .navbar__toggle { 6 | margin-right: 1rem !important; 7 | } 8 | 9 | .navbar__title { 10 | font-size: 1.2rem; 11 | margin-left: 0.2rem; 12 | display: none; 13 | } 14 | 15 | .navbar-sidebar__brand .navbar__title { 16 | display: inline; 17 | } 18 | 19 | .navbar__item.navbar__link[href*="github"], 20 | .navbar__item.navbar__link[href*="npmjs"] { 21 | position: relative; 22 | padding: 0 1.5rem 0 0; 23 | display: flex; 24 | font-size: 0; 25 | } 26 | 27 | .navbar__item.navbar__link[href*="github"]:before { 28 | content: ""; 29 | width: 1.5rem; 30 | height: 1.5rem; 31 | background-image: url("/img/brand-github.svg"); 32 | background-repeat: no-repeat; 33 | } 34 | 35 | .navbar__items .react-toggle { 36 | margin-right: 5px; 37 | } 38 | 39 | .react-toggle--focus .react-toggle-thumb, 40 | .react-toggle:hover .react-toggle-thumb { 41 | box-shadow: none !important; 42 | } 43 | 44 | .navbar__search-input:focus { 45 | outline: none; 46 | box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, 47 | rgba(19, 19, 19, 0.2) 0px 0px 0px 4px, rgba(0, 0, 0, 0) 0px 0px 0px 0px; 48 | transition: box-shadow 350ms ease-in-out; 49 | } 50 | html[data-theme="dark"] .navbar__search-input:focus { 51 | box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, 52 | rgba(29, 29, 29, 0.5) 0px 0px 0px 4px, rgba(0, 0, 0, 0) 0px 0px 0px 0px; 53 | } 54 | 55 | html[data-theme="dark"] .navbar__item.navbar__link[href*="github"]:before { 56 | background-image: url("/img/brand-github-inverted.svg"); 57 | } 58 | 59 | .navbar__item.navbar__link[href*="npmjs"]:before { 60 | content: ""; 61 | width: 3rem; 62 | height: 1.2rem; 63 | margin-top: 0.2rem; 64 | background-image: url("/img/brand-npm.svg"); 65 | background-repeat: no-repeat; 66 | } 67 | 68 | html[data-theme="dark"] .navbar__item.navbar__link[href*="npm"]:before { 69 | background-image: url("/img/brand-npm-inverted.svg"); 70 | } 71 | 72 | @media screen and (max-width: 966px) { 73 | .navbar__item.navbar__link[href*="github"], 74 | .navbar__item.navbar__link[href*="npmjs"] { 75 | display: none; 76 | } 77 | } 78 | 79 | @media screen and (min-width: 420px) { 80 | .navbar__title { 81 | display: inline; 82 | } 83 | } 84 | 85 | .github-counter { 86 | position: absolute; 87 | color: #000; 88 | top: -10px; 89 | right: 5px; 90 | font-size: 9px; 91 | background-color: #ccc; 92 | padding: 2px 5px; 93 | border-radius: 10px; 94 | z-index: -1; 95 | } 96 | 97 | html[data-theme="dark"] .github-counter { 98 | background-color: #222; 99 | color: #fff; 100 | } 101 | -------------------------------------------------------------------------------- /src/css/providers.css: -------------------------------------------------------------------------------- 1 | .provider-name-list { 2 | display: flex; 3 | flex-wrap: wrap; 4 | } 5 | 6 | .provider-name-list__comma { 7 | display: inline-flex; 8 | margin-right: 5px; 9 | } 10 | -------------------------------------------------------------------------------- /src/css/search.css: -------------------------------------------------------------------------------- 1 | html[data-theme="light"]:root { 2 | --docsearch-searchbox-shadow: inset 0 0 0 2px #a553b3; 3 | } 4 | 5 | html[data-theme="light"] .DocSearch-Modal .DocSearch-Search-Icon { 6 | color: #a553b3; 7 | } 8 | 9 | html[data-theme="dark"] .DocSearch-Modal .DocSearch-Search-Icon { 10 | color: #7c2f89; 11 | } 12 | 13 | html[data-theme="dark"]:root { 14 | --docsearch-searchbox-background: #040404; 15 | --docsearch-key-gradient: #000; 16 | --docsearch-key-shadow: #ccc; 17 | --docsearch-searchbox-shadow: inset 0 0 0 2px #7c2f89; 18 | } 19 | 20 | html[data-theme="dark"] .DocSearch-Button-Key { 21 | --docsearch-muted-color: #333; 22 | } 23 | 24 | @media screen and (max-width: 740px) { 25 | .DocSearch-Container { 26 | margin-top: 60px; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /* stylelint-disable docusaurus/copyright-header */ 2 | /** 3 | * CSS files with the .module.css suffix will be treated as CSS modules 4 | * and scoped locally. 5 | */ 6 | 7 | .heroBanner { 8 | padding: 4rem 0 0 0; 9 | text-align: center; 10 | position: relative; 11 | } 12 | 13 | @media screen and (max-width: 966px) { 14 | .heroBanner { 15 | padding: 2rem 2rem 0 2rem; 16 | } 17 | } 18 | 19 | .heroLogo { 20 | margin-bottom: 0.5rem; 21 | width: 8rem; 22 | } 23 | 24 | @media screen and (min-width: 689px) { 25 | .heroLogo { 26 | margin-bottom: -0.5rem; 27 | } 28 | } 29 | 30 | @media screen and (min-width: 689px) { 31 | .heroText { 32 | display: inline-block; 33 | margin: 1rem 1.5rem 0 2rem; 34 | } 35 | } 36 | 37 | .buttons { 38 | display: flex; 39 | align-items: center; 40 | justify-content: center; 41 | padding: 4rem 1rem 0 1rem; 42 | } 43 | 44 | .button { 45 | margin: 0 0.5rem; 46 | } 47 | 48 | .features { 49 | display: flex; 50 | align-items: center; 51 | padding-top: 4rem; 52 | margin: 0 auto 0 auto; 53 | width: 100%; 54 | } 55 | 56 | .featuresTitle { 57 | font-size: 2.5rem; 58 | line-height: 3rem; 59 | margin: 2rem 0 4rem 0; 60 | text-align: center; 61 | font-weight: 800 !important; 62 | } 63 | 64 | .featuresTitle span { 65 | display: inline-block; 66 | margin: 0 1rem; 67 | } 68 | 69 | @media screen and (max-width: 966px) { 70 | .featuresTitle span { 71 | display: block; 72 | margin: 1rem 0; 73 | } 74 | } 75 | 76 | .features h3 { 77 | font-size: 2rem; 78 | line-height: 4rem; 79 | margin: 1rem 0 2rem 0; 80 | font-weight: 800; 81 | } 82 | 83 | .features ul { 84 | list-style: none; 85 | text-align: center; 86 | padding: 0; 87 | } 88 | 89 | .features ul li { 90 | margin-top: 0.5rem; 91 | margin-bottom: 0.5rem; 92 | font-size: 1rem; 93 | white-space: nowrap; 94 | text-align: center; 95 | } 96 | 97 | .features ul li em { 98 | font-weight: 400; 99 | opacity: 0.8; 100 | } 101 | 102 | .featureImage { 103 | height: 220px; 104 | width: 220px; 105 | } 106 | 107 | .homeSubtitle { 108 | justify-content: center; 109 | padding: 0rem 0 2rem 0; 110 | opacity: 0.6; 111 | font-style: italic; 112 | margin: 0 auto; 113 | font-size: 1.2rem; 114 | text-align: center; 115 | } 116 | -------------------------------------------------------------------------------- /src/pages/seo.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import Head from "@docusaurus/Head" 3 | import useDocusaurusContext from "@docusaurus/useDocusaurusContext" 4 | 5 | const Seo = () => { 6 | const context = useDocusaurusContext() 7 | const { siteConfig = {} } = context 8 | const { title, tagline, url } = siteConfig 9 | 10 | return ( 11 | <Head> 12 | <meta charSet="utf-8" /> 13 | <link rel="canonical" href={url} /> 14 | <meta property="og:title" content={title} /> 15 | <meta property="og:description" content={tagline} /> 16 | <meta property="og:image" content={`${url}/img/social-media-card.png`} /> 17 | <meta property="og:url" content={url} /> 18 | <meta name="twitter:card" content="summary_large_image" /> 19 | <meta name="twitter:title" content={title} /> 20 | <meta name="twitter:description" content={tagline} /> 21 | <meta name="twitter:image" content={`${url}/img/social-media-card.png`} /> 22 | </Head> 23 | ) 24 | } 25 | 26 | export default Seo 27 | -------------------------------------------------------------------------------- /static/googlecfaeef9e241b87bc.html: -------------------------------------------------------------------------------- 1 | google-site-verification: googlecfaeef9e241b87bc.html -------------------------------------------------------------------------------- /static/img/brand-github-inverted.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-prefix="fab" data-icon="github" class="svg-inline--fa fa-github fa-w-16" viewBox="0 0 496 496"> 3 | <path fill="#fff" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/> 4 | </svg> 5 | -------------------------------------------------------------------------------- /static/img/brand-github.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-prefix="fab" data-icon="github" class="svg-inline--fa fa-github fa-w-16" viewBox="0 0 496 496"> 3 | <path fill="#222" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/> 4 | </svg> 5 | -------------------------------------------------------------------------------- /static/img/brand-npm-inverted.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 2 | <svg width="48px" height="18px" viewBox="0 0 256 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> 3 | <g> 4 | <path d="M0,0 L0,85.4980695 L71.1660232,85.4980695 L71.1660232,99.8301158 L128,99.8301158 L128,85.4980695 L256,85.4980695 L256,0 L0,0 L0,0 Z" fill="#fff"></path> 5 | <path d="M42.5019305,14.3320463 L14.3320463,14.3320463 L14.3320463,28.6640927 L14.3320463,71.1660232 L42.5019305,71.1660232 L42.5019305,28.6640927 L56.8339768,28.6640927 L56.8339768,71.1660232 L71.1660232,71.1660232 L71.1660232,28.6640927 L71.1660232,14.3320463 L42.5019305,14.3320463 L42.5019305,14.3320463 Z" fill="#000"></path> 6 | <path d="M85.4980695,14.3320463 L85.4980695,68.2007722 L85.4980695,71.1660232 L85.4980695,85.4980695 L114.162162,85.4980695 L114.162162,71.1660232 L142.332046,71.1660232 L142.332046,14.3320463 L85.4980695,14.3320463 L85.4980695,14.3320463 Z M128,56.8339768 L114.162162,56.8339768 L114.162162,28.6640927 L128,28.6640927 L128,56.8339768 L128,56.8339768 Z" fill="#000"></path> 7 | <path d="M184.833977,14.3320463 L156.664093,14.3320463 L156.664093,28.6640927 L156.664093,71.1660232 L184.833977,71.1660232 L184.833977,28.6640927 L199.166023,28.6640927 L199.166023,71.1660232 L213.498069,71.1660232 L213.498069,28.6640927 L227.830116,28.6640927 L227.830116,71.1660232 L242.162162,71.1660232 L242.162162,28.6640927 L242.162162,15.3204633 L242.162162,14.3320463 L184.833977,14.3320463 L184.833977,14.3320463 Z" fill="#000"></path> 8 | </g> 9 | </svg> 10 | -------------------------------------------------------------------------------- /static/img/brand-npm.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 2 | <svg width="48px" height="18px" viewBox="0 0 256 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> 3 | <g> 4 | <path d="M0,0 L0,85.4980695 L71.1660232,85.4980695 L71.1660232,99.8301158 L128,99.8301158 L128,85.4980695 L256,85.4980695 L256,0 L0,0 L0,0 Z" fill="#000"></path> 5 | <path d="M42.5019305,14.3320463 L14.3320463,14.3320463 L14.3320463,28.6640927 L14.3320463,71.1660232 L42.5019305,71.1660232 L42.5019305,28.6640927 L56.8339768,28.6640927 L56.8339768,71.1660232 L71.1660232,71.1660232 L71.1660232,28.6640927 L71.1660232,14.3320463 L42.5019305,14.3320463 L42.5019305,14.3320463 Z" fill="#fff"></path> 6 | <path d="M85.4980695,14.3320463 L85.4980695,68.2007722 L85.4980695,71.1660232 L85.4980695,85.4980695 L114.162162,85.4980695 L114.162162,71.1660232 L142.332046,71.1660232 L142.332046,14.3320463 L85.4980695,14.3320463 L85.4980695,14.3320463 Z M128,56.8339768 L114.162162,56.8339768 L114.162162,28.6640927 L128,28.6640927 L128,56.8339768 L128,56.8339768 Z" fill="#fff"></path> 7 | <path d="M184.833977,14.3320463 L156.664093,14.3320463 L156.664093,28.6640927 L156.664093,71.1660232 L184.833977,71.1660232 L184.833977,28.6640927 L199.166023,28.6640927 L199.166023,71.1660232 L213.498069,71.1660232 L213.498069,28.6640927 L227.830116,28.6640927 L227.830116,71.1660232 L242.162162,71.1660232 L242.162162,28.6640927 L242.162162,15.3204633 L242.162162,14.3320463 L184.833977,14.3320463 L184.833977,14.3320463 Z" fill="#fff"></path> 8 | </g> 9 | </svg> 10 | -------------------------------------------------------------------------------- /static/img/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/favicon-16x16.png -------------------------------------------------------------------------------- /static/img/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/favicon-32x32.png -------------------------------------------------------------------------------- /static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/favicon.ico -------------------------------------------------------------------------------- /static/img/logo/logo-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/logo/logo-sm.png -------------------------------------------------------------------------------- /static/img/logo/logo-xs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/logo/logo-xs.png -------------------------------------------------------------------------------- /static/img/logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/logo/logo.png -------------------------------------------------------------------------------- /static/img/mesh-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/mesh-1.jpg -------------------------------------------------------------------------------- /static/img/mesh-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/mesh-2.jpg -------------------------------------------------------------------------------- /static/img/mesh-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/mesh-3.jpg -------------------------------------------------------------------------------- /static/img/nextauth_v4_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/nextauth_v4_schema.png -------------------------------------------------------------------------------- /static/img/nextjs-logo.svg: -------------------------------------------------------------------------------- 1 | <svg height="1509" viewBox=".145 .207 147.685 89.291" width="2500" xmlns="http://www.w3.org/2000/svg"><path d="m34.992 23.495h27.855v2.219h-25.301v16.699h23.792v2.219h-23.792v18.334h25.591v2.219h-28.145zm30.35 0h2.96l13.115 18.334 13.405-18.334 18.233-23.288-29.955 43.549 15.436 21.429h-3.076l-14.043-19.502-14.101 19.502h-3.018l15.552-21.429-14.507-20.261zm34.297 2.219v-2.219h31.742v2.219h-14.623v39.47h-2.554v-39.47h-14.564zm-99.494-2.219h3.192l44.011 66.003-18.188-24.313-26.346-38.537-.116 38.537h-2.553zm130.98 38.801c-.523 0-.914-.405-.914-.928 0-.524.391-.929.913-.929.528 0 .913.405.913.929 0 .523-.385.928-.913.928zm2.508-2.443h1.367c.019.742.56 1.24 1.354 1.24.888 0 1.391-.535 1.391-1.539v-6.356h1.391v6.362c0 1.808-1.043 2.849-2.77 2.849-1.62 0-2.732-1.01-2.732-2.556zm7.322-.08h1.379c.118.853.95 1.395 2.149 1.395 1.117 0 1.937-.58 1.937-1.377 0-.685-.521-1.097-1.708-1.377l-1.155-.28c-1.62-.38-2.36-1.166-2.36-2.487 0-1.602 1.304-2.668 3.26-2.668 1.82 0 3.15 1.066 3.23 2.58h-1.354c-.13-.828-.85-1.346-1.894-1.346-1.1 0-1.832.53-1.832 1.34 0 .642.472 1.01 1.64 1.284l.987.243c1.838.43 2.596 1.178 2.596 2.53 0 1.72-1.33 2.799-3.453 2.799-1.987 0-3.323-1.029-3.422-2.637z"/></svg> -------------------------------------------------------------------------------- /static/img/pages_signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/pages_signin.png -------------------------------------------------------------------------------- /static/img/pages_signout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/pages_signout.png -------------------------------------------------------------------------------- /static/img/providers/apple-black.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" width="2036" height="2500" viewBox="0 0 456.008 560.035" fill="#3c5a9a"><path d="M380.844 297.529c.787 84.752 74.349 112.955 75.164 113.314-.622 1.988-11.754 40.191-38.756 79.652-23.343 34.117-47.568 68.107-85.731 68.811-37.499.691-49.557-22.236-92.429-22.236-42.859 0-56.256 21.533-91.753 22.928-36.837 1.395-64.889-36.891-88.424-70.883-48.093-69.53-84.846-196.475-35.496-282.165 24.516-42.554 68.328-69.501 115.882-70.192 36.173-.69 70.315 24.336 92.429 24.336 22.1 0 63.59-30.096 107.208-25.676 18.26.76 69.517 7.376 102.429 55.552-2.652 1.644-61.159 35.704-60.523 106.559M310.369 89.418C329.926 65.745 343.089 32.79 339.498 0 311.308 1.133 277.22 18.785 257 42.445c-18.121 20.952-33.991 54.487-29.709 86.628 31.421 2.431 63.52-15.967 83.078-39.655"/></svg> 2 | -------------------------------------------------------------------------------- /static/img/providers/auth0.svg: -------------------------------------------------------------------------------- 1 | <svg width="2230" height="2500" viewBox="0 0 256 287" xmlns="http://www.w3.org/2000/svg"><path d="M203.24 231.531l-28.73-88.434 75.208-54.64h-92.966L128.019.025l-.009-.024h92.98l28.74 88.446.002-.002.024-.013c16.69 51.31-.5 109.67-46.516 143.098zm-150.45 0l-.023.017 75.228 54.655 75.245-54.67-75.221-54.656-75.228 54.654zM6.295 88.434c-17.57 54.088 2.825 111.4 46.481 143.108l.007-.028 28.735-88.429-75.192-54.63h92.944L128.004.024 128.01 0H35.025L6.294 88.434z" fill="#EB5424"/></svg> 2 | -------------------------------------------------------------------------------- /static/img/providers/aws-cognito.svg: -------------------------------------------------------------------------------- 1 | <svg width="2140" height="2500" viewBox="0 0 256 299" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M208.752 58.061l25.771-6.636.192.283.651 155.607-.843.846-5.31.227-20.159-3.138-.302-.794V58.061M59.705 218.971l.095.007 68.027 19.767.173.133.296.236-.096 59.232-.2.252-68.295-33.178v-46.449" fill="#7A3E65"/><path d="M208.752 204.456l-80.64 19.312-40.488-9.773-27.919 4.976L128 238.878l105.405-28.537 1.118-2.18-25.771-3.705" fill="#CFB2C1"/><path d="M196.295 79.626l-.657-.749-66.904-19.44-.734.283-.672-.343L22.052 89.734l-.575.703.845.463 24.075 3.53.851-.289 80.64-19.311 40.488 9.773 27.919-4.977" fill="#512843"/><path d="M47.248 240.537l-25.771 6.221-.045-.149-1.015-155.026 1.06-1.146 25.771 3.704v146.396" fill="#C17B9E"/><path d="M82.04 180.403l45.96 5.391.345-.515.187-71.887-.532-.589-45.96 5.392v62.208" fill="#7A3E65"/><path d="M173.96 180.403L128 185.794v-72.991l45.96 5.392v62.208M196.295 79.626L128 59.72V0l68.295 33.177v46.449" fill="#C17B9E"/><path d="M128 0L0 61.793v175.011l21.477 9.954V90.437L128 59.72V0" fill="#7A3E65"/><path d="M234.523 51.425v156.736L128 238.878v59.72l128-61.794V61.793l-21.477-10.368" fill="#C17B9E"/></svg> -------------------------------------------------------------------------------- /static/img/providers/box.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" width="2500" height="1379" viewBox="0 0 444.893 245.414"><g fill="#0075C9"><path d="M239.038 72.43c-33.081 0-61.806 18.6-76.322 45.904-14.516-27.305-43.24-45.902-76.32-45.902-19.443 0-37.385 6.424-51.821 17.266V16.925h-.008C34.365 7.547 26.713 0 17.286 0 7.858 0 .208 7.547.008 16.925H0v143.333h.036c.768 47.051 39.125 84.967 86.359 84.967 33.08 0 61.805-18.603 76.32-45.908 14.517 27.307 43.241 45.906 76.321 45.906 47.715 0 86.396-38.684 86.396-86.396.001-47.718-38.682-86.397-86.394-86.397zM86.395 210.648c-28.621 0-51.821-23.201-51.821-51.82 0-28.623 23.201-51.823 51.821-51.823 28.621 0 51.822 23.2 51.822 51.823 0 28.619-23.201 51.82-51.822 51.82zm152.643 0c-28.622 0-51.821-23.201-51.821-51.822 0-28.623 23.2-51.821 51.821-51.821 28.619 0 51.822 23.198 51.822 51.821-.001 28.621-23.203 51.822-51.822 51.822z"/><path d="M441.651 218.033l-44.246-59.143 44.246-59.144-.008-.007c5.473-7.62 3.887-18.249-3.652-23.913-7.537-5.658-18.187-4.221-23.98 3.157l-.004-.002-38.188 51.047-38.188-51.047-.006.009c-5.793-7.385-16.441-8.822-23.981-3.16-7.539 5.664-9.125 16.293-3.649 23.911l-.008.005 44.245 59.144-44.245 59.143.008.005c-5.477 7.62-3.89 18.247 3.649 23.909 7.54 5.664 18.188 4.225 23.981-3.155l.006.007 38.188-51.049 38.188 51.049.004-.002c5.794 7.377 16.443 8.814 23.98 3.154 7.539-5.662 9.125-16.291 3.652-23.91l.008-.008z"/></g></svg> -------------------------------------------------------------------------------- /static/img/providers/discord.svg: -------------------------------------------------------------------------------- 1 | <svg width="2184" height="2500" viewBox="0 0 256 293" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M226.011 0H29.99C13.459 0 0 13.458 0 30.135v197.778c0 16.677 13.458 30.135 29.989 30.135h165.888l-7.754-27.063 18.725 17.408 17.7 16.384L256 292.571V30.135C256 13.458 242.542 0 226.011 0zm-56.466 191.05s-5.266-6.291-9.655-11.85c19.164-5.413 26.478-17.408 26.478-17.408-5.998 3.95-11.703 6.73-16.823 8.63-7.314 3.073-14.336 5.12-21.211 6.291-14.044 2.633-26.917 1.902-37.888-.146-8.339-1.61-15.507-3.95-21.504-6.29-3.365-1.317-7.022-2.926-10.68-4.974-.438-.293-.877-.439-1.316-.732-.292-.146-.439-.292-.585-.438-2.633-1.463-4.096-2.487-4.096-2.487s7.022 11.703 25.6 17.261c-4.388 5.56-9.801 12.142-9.801 12.142-32.33-1.024-44.617-22.235-44.617-22.235 0-47.104 21.065-85.285 21.065-85.285 21.065-15.799 41.106-15.36 41.106-15.36l1.463 1.756C80.75 77.53 68.608 89.088 68.608 89.088s3.218-1.755 8.63-4.242c15.653-6.876 28.088-8.777 33.208-9.216.877-.147 1.609-.293 2.487-.293a123.776 123.776 0 0 1 29.55-.292c13.896 1.609 28.818 5.705 44.031 14.043 0 0-11.556-10.971-36.425-18.578l2.048-2.34s20.041-.44 41.106 15.36c0 0 21.066 38.18 21.066 85.284 0 0-12.435 21.211-44.764 22.235zm-68.023-68.316c-8.338 0-14.92 7.314-14.92 16.237 0 8.924 6.728 16.238 14.92 16.238 8.339 0 14.921-7.314 14.921-16.238.147-8.923-6.582-16.237-14.92-16.237m53.394 0c-8.339 0-14.922 7.314-14.922 16.237 0 8.924 6.73 16.238 14.922 16.238 8.338 0 14.92-7.314 14.92-16.238 0-8.923-6.582-16.237-14.92-16.237" fill="#7289DA"/></svg> -------------------------------------------------------------------------------- /static/img/providers/facebook-2.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" width="1298" height="2500" viewBox="88.428 12.828 107.543 207.085"><path d="M158.232 219.912v-94.461h31.707l4.747-36.813h-36.454V65.134c0-10.658 2.96-17.922 18.245-17.922l19.494-.009V14.278c-3.373-.447-14.944-1.449-28.406-1.449-28.106 0-47.348 17.155-47.348 48.661v27.149H88.428v36.813h31.788v94.461l38.016-.001z" fill="#3c5a9a"/></svg> -------------------------------------------------------------------------------- /static/img/providers/github-1.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 4 | x="0px" y="0px" viewBox="0 0 2350 2314.8" xml:space="preserve" fill="#3c5a9a"> 5 | <path d="M1175,0C525.8,0,0,525.8,0,1175c0,552.2,378.9,1010.5,890.1,1139.7c-5.9-14.7-8.8-35.3-8.8-55.8v-199.8H734.4 6 | c-79.3,0-152.8-35.2-185.1-99.9c-38.2-70.5-44.1-179.2-141-246.8c-29.4-23.5-5.9-47,26.4-44.1c61.7,17.6,111.6,58.8,158.6,120.4 7 | c47,61.7,67.6,76.4,155.7,76.4c41.1,0,105.7-2.9,164.5-11.8c32.3-82.3,88.1-155.7,155.7-190.9c-393.6-47-581.6-240.9-581.6-505.3 8 | c0-114.6,49.9-223.3,132.2-317.3c-26.4-91.1-61.7-279.1,11.8-352.5c176.3,0,282,114.6,308.4,143.9c88.1-29.4,185.1-47,284.9-47 9 | c102.8,0,196.8,17.6,284.9,47c26.4-29.4,132.2-143.9,308.4-143.9c70.5,70.5,38.2,261.4,8.8,352.5c82.3,91.1,129.3,202.7,129.3,317.3 10 | c0,264.4-185.1,458.3-575.7,499.4c108.7,55.8,185.1,214.4,185.1,331.9V2256c0,8.8-2.9,17.6-2.9,26.4 11 | C2021,2123.8,2350,1689.1,2350,1175C2350,525.8,1824.2,0,1175,0L1175,0z"/> 12 | </svg> 13 | -------------------------------------------------------------------------------- /static/img/providers/gitlab.svg: -------------------------------------------------------------------------------- 1 | <svg width="2500" height="2305" viewBox="0 0 256 236" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet"><path d="M128.075 236.075l47.104-144.97H80.97l47.104 144.97z" fill="#E24329"/><path d="M128.075 236.074L80.97 91.104H14.956l113.119 144.97z" fill="#FC6D26"/><path d="M14.956 91.104L.642 135.16a9.752 9.752 0 0 0 3.542 10.903l123.891 90.012-113.12-144.97z" fill="#FCA326"/><path d="M14.956 91.105H80.97L52.601 3.79c-1.46-4.493-7.816-4.492-9.275 0l-28.37 87.315z" fill="#E24329"/><path d="M128.075 236.074l47.104-144.97h66.015l-113.12 144.97z" fill="#FC6D26"/><path d="M241.194 91.104l14.314 44.056a9.752 9.752 0 0 1-3.543 10.903l-123.89 90.012 113.119-144.97z" fill="#FCA326"/><path d="M241.194 91.105h-66.015l28.37-87.315c1.46-4.493 7.816-4.492 9.275 0l28.37 87.315z" fill="#E24329"/></svg> -------------------------------------------------------------------------------- /static/img/providers/google-icon.svg: -------------------------------------------------------------------------------- 1 | <svg width="2443" height="2500" viewBox="0 0 256 262" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027" fill="#4285F4"/><path d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1" fill="#34A853"/><path d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782" fill="#FBBC05"/><path d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251" fill="#EB4335"/></svg> -------------------------------------------------------------------------------- /static/img/providers/openid.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="iso-8859-1"?> 2 | <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 4 | viewBox="0 0 25.573 25.573" style="enable-background:new 0 0 25.573 25.573;" xml:space="preserve"> 5 | <g> 6 | <g> 7 | <polygon style="fill:#030104;" points="12.036,24.589 12.036,3.296 15.391,0.983 15.391,22.74 "/> 8 | <path style="fill:#030104;" d="M11.11,7.926v2.893c0,0-6.632,0.521-7.058,5.556c0,0-0.93,4.396,7.058,5.785v2.43 9 | c0,0-11.226-1.155-11.109-8.331C0.001,16.258-0.115,8.968,11.11,7.926z"/> 10 | <path style="fill:#030104;" d="M16.2,7.926v2.702c0,0,2.142-0.029,3.934,1.463l-1.964,0.807l7.403,1.855V8.967l-2.527,1.43 11 | C23.046,10.397,20.889,8.13,16.2,7.926z"/> 12 | </g> 13 | </g> 14 | <g> 15 | </g> 16 | <g> 17 | </g> 18 | <g> 19 | </g> 20 | <g> 21 | </g> 22 | <g> 23 | </g> 24 | <g> 25 | </g> 26 | <g> 27 | </g> 28 | <g> 29 | </g> 30 | <g> 31 | </g> 32 | <g> 33 | </g> 34 | <g> 35 | </g> 36 | <g> 37 | </g> 38 | <g> 39 | </g> 40 | <g> 41 | </g> 42 | <g> 43 | </g> 44 | </svg> 45 | -------------------------------------------------------------------------------- /static/img/providers/slack.svg: -------------------------------------------------------------------------------- 1 | <svg enable-background="new 0 0 2447.6 2452.5" viewBox="0 0 2447.6 2452.5" xmlns="http://www.w3.org/2000/svg"><g clip-rule="evenodd" fill-rule="evenodd"><path d="m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z" fill="#36c5f0"/><path d="m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z" fill="#2eb67d"/><path d="m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z" fill="#ecb22e"/><path d="m0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0" fill="#e01e5a"/></g></svg> -------------------------------------------------------------------------------- /static/img/providers/spotify.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <svg xmlns="http://www.w3.org/2000/svg" height="168px" width="168px" version="1.1" viewBox="0 0 168 168"> 3 | <path fill="#1ED760" d="m83.996 0.277c-46.249 0-83.743 37.493-83.743 83.742 0 46.251 37.494 83.741 83.743 83.741 46.254 0 83.744-37.49 83.744-83.741 0-46.246-37.49-83.738-83.745-83.738l0.001-0.004zm38.404 120.78c-1.5 2.46-4.72 3.24-7.18 1.73-19.662-12.01-44.414-14.73-73.564-8.07-2.809 0.64-5.609-1.12-6.249-3.93-0.643-2.81 1.11-5.61 3.926-6.25 31.9-7.291 59.263-4.15 81.337 9.34 2.46 1.51 3.24 4.72 1.73 7.18zm10.25-22.805c-1.89 3.075-5.91 4.045-8.98 2.155-22.51-13.839-56.823-17.846-83.448-9.764-3.453 1.043-7.1-0.903-8.148-4.35-1.04-3.453 0.907-7.093 4.354-8.143 30.413-9.228 68.222-4.758 94.072 11.127 3.07 1.89 4.04 5.91 2.15 8.976v-0.001zm0.88-23.744c-26.99-16.031-71.52-17.505-97.289-9.684-4.138 1.255-8.514-1.081-9.768-5.219-1.254-4.14 1.08-8.513 5.221-9.771 29.581-8.98 78.756-7.245 109.83 11.202 3.73 2.209 4.95 7.016 2.74 10.733-2.2 3.722-7.02 4.949-10.73 2.739z"/> 4 | </svg> 5 | -------------------------------------------------------------------------------- /static/img/providers/twitter.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <svg width="256px" height="209px" viewBox="0 0 256 209" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"> 3 | <g> 4 | <path d="M256,25.4500259 C246.580841,29.6272672 236.458451,32.4504868 225.834156,33.7202333 C236.678503,27.2198053 245.00583,16.9269929 248.927437,4.66307685 C238.779765,10.6812633 227.539325,15.0523376 215.57599,17.408298 C205.994835,7.2006971 192.34506,0.822 177.239197,0.822 C148.232605,0.822 124.716076,24.3375931 124.716076,53.3423116 C124.716076,57.4586875 125.181462,61.4673784 126.076652,65.3112644 C82.4258385,63.1210453 43.7257252,42.211429 17.821398,10.4359288 C13.3005011,18.1929938 10.710443,27.2151234 10.710443,36.8402889 C10.710443,55.061526 19.9835254,71.1374907 34.0762135,80.5557137 C25.4660961,80.2832239 17.3681846,77.9207088 10.2862577,73.9869292 C10.2825122,74.2060448 10.2825122,74.4260967 10.2825122,74.647085 C10.2825122,100.094453 28.3867003,121.322443 52.413563,126.14673 C48.0059695,127.347184 43.3661509,127.988612 38.5755734,127.988612 C35.1914554,127.988612 31.9009766,127.659938 28.694773,127.046602 C35.3777973,147.913145 54.7742053,163.097665 77.7569918,163.52185 C59.7820257,177.607983 37.1354036,186.004604 12.5289147,186.004604 C8.28987161,186.004604 4.10888474,185.75646 0,185.271409 C23.2431033,200.173139 50.8507261,208.867532 80.5109185,208.867532 C177.116529,208.867532 229.943977,128.836982 229.943977,59.4326002 C229.943977,57.1552968 229.893412,54.8901664 229.792282,52.6381454 C240.053257,45.2331635 248.958338,35.9825545 256,25.4500259" fill="#55acee"></path> 5 | </g> 6 | </svg> -------------------------------------------------------------------------------- /static/img/signin-complex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/signin-complex.png -------------------------------------------------------------------------------- /static/img/signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/signin.png -------------------------------------------------------------------------------- /static/img/social-media-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesstelford/docs/96814076ce398a25f0b18cd820d1e424b56bbed7/static/img/social-media-card.png -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "redirects": [ 3 | { 4 | "source": "/schemas/models", 5 | "destination": "/adapters/models", 6 | "permanent": true 7 | }, 8 | { 9 | "source": "/schemas/mysql", 10 | "destination": "/adapters/typeorm/mysql", 11 | "permanent": true 12 | }, 13 | { 14 | "source": "/schemas/postgres", 15 | "destination": "/adapters/typeorm/postgres", 16 | "permanent": true 17 | }, 18 | { 19 | "source": "/schemas/mssql", 20 | "destination": "/adapters/typeorm/mssql", 21 | "permanent": true 22 | }, 23 | { 24 | "source": "/schemas/mongodb", 25 | "destination": "/adapters/typeorm/mongodb", 26 | "permanent": true 27 | }, 28 | { 29 | "source": "/schemas/adapters", 30 | "destination": "/adapters/overview", 31 | "permanent": true 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/dynamodb.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: dynamodb 3 | title: DynamoDB Adapter 4 | --- 5 | 6 | # DynamoDB 7 | 8 | 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. 9 | 10 | 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. 11 | 12 | You can find the full schema in the table structure section below. 13 | 14 | ## Getting Started 15 | 16 | 1. Install `next-auth` and `@next-auth/dynamodb-adapter@canary` 17 | 18 | ```js 19 | npm install next-auth @next-auth/dynamodb-adapter@canary 20 | ``` 21 | 22 | 2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object. 23 | 24 | You need to pass `DocumentClient` instance from `aws-sdk` to the adapter. 25 | 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. 26 | 27 | ```javascript title="pages/api/auth/[...nextauth].js" 28 | import AWS from "aws-sdk"; 29 | import NextAuth from "next-auth"; 30 | import Providers from "next-auth/providers"; 31 | import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter" 32 | 33 | AWS.config.update({ 34 | accessKeyId: process.env.NEXT_AUTH_AWS_ACCESS_KEY, 35 | secretAccessKey: process.env.NEXT_AUTH_AWS_SECRET_KEY, 36 | region: process.env.NEXT_AUTH_AWS_REGION, 37 | }); 38 | 39 | export default NextAuth({ 40 | // Configure one or more authentication providers 41 | providers: [ 42 | Providers.GitHub({ 43 | clientId: process.env.GITHUB_ID, 44 | clientSecret: process.env.GITHUB_SECRET, 45 | }), 46 | Providers.Email({ 47 | server: process.env.EMAIL_SERVER, 48 | from: process.env.EMAIL_FROM, 49 | }), 50 | // ...add more providers here 51 | ], 52 | adapter: DynamoDBAdapter( 53 | new AWS.DynamoDB.DocumentClient() 54 | ), 55 | ... 56 | }); 57 | ``` 58 | 59 | (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).) 60 | 61 | ## Schema 62 | 63 | The table respects the single table design pattern. This has many advantages: 64 | 65 | - Only one table to manage, monitor and provision. 66 | - Querying relations is faster than with multi-table schemas (for eg. retrieving all sessions for a user). 67 | - Only one table needs to be replicated, if you want to go multi-region. 68 | 69 | Here is a schema of the table : 70 | 71 | ![DynamoDB Table](https://i.imgur.com/hGZtWDq.png) 72 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/fauna.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fauna 3 | title: FaunaDB Adapter 4 | --- 5 | 6 | # FaunaDB 7 | 8 | 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. 9 | 10 | 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). 11 | 12 | ## Getting Started 13 | 14 | 1. Install `next-auth` and `@next-auth/fauna-adapter@canary` 15 | 16 | ```js 17 | npm install next-auth @next-auth/fauna-adapter@canary 18 | ``` 19 | 20 | 2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object. 21 | 22 | ```javascript title="pages/api/auth/[...nextauth].js" 23 | import NextAuth from "next-auth" 24 | import Providers from "next-auth/providers" 25 | import * as Fauna from "faunadb" 26 | import { FaunaAdapter } from "@next-auth/fauna-adapter" 27 | 28 | const client = new Fauna.Client({ 29 | secret: "secret", 30 | scheme: "http", 31 | domain: "localhost", 32 | port: 8443, 33 | }) 34 | 35 | // For more information on each option (and a full list of options) go to 36 | // https://next-auth.js.org/configuration/options 37 | export default NextAuth({ 38 | // https://next-auth.js.org/configuration/providers 39 | providers: [ 40 | Providers.Google({ 41 | clientId: process.env.GOOGLE_ID, 42 | clientSecret: process.env.GOOGLE_SECRET, 43 | }), 44 | ], 45 | adapter: FaunaAdapter({ faunaClient: client}) 46 | ... 47 | }) 48 | ``` 49 | 50 | ## Schema 51 | 52 | ```javascript 53 | CreateCollection({ name: "accounts" }) 54 | CreateCollection({ name: "sessions" }) 55 | CreateCollection({ name: "users" }) 56 | CreateCollection({ name: "verification_requests" }) 57 | CreateIndex({ 58 | name: "account_by_provider_account_id", 59 | source: Collection("accounts"), 60 | unique: true, 61 | terms: [ 62 | { field: ["data", "providerId"] }, 63 | { field: ["data", "providerAccountId"] }, 64 | ], 65 | }) 66 | CreateIndex({ 67 | name: "session_by_token", 68 | source: Collection("sessions"), 69 | unique: true, 70 | terms: [{ field: ["data", "sessionToken"] }], 71 | }) 72 | CreateIndex({ 73 | name: "user_by_email", 74 | source: Collection("users"), 75 | unique: true, 76 | terms: [{ field: ["data", "email"] }], 77 | }) 78 | CreateIndex({ 79 | name: "verification_request_by_token", 80 | source: Collection("verification_requests"), 81 | unique: true, 82 | terms: [{ field: ["data", "token"] }, { field: ["data", "identifier"] }], 83 | }) 84 | ``` 85 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/models.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: models 3 | title: Models 4 | --- 5 | 6 | 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. 7 | 8 | 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. 9 | 10 | :::note 11 | You can [extend the built in models](/v3/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. 12 | ::: 13 | 14 | --- 15 | 16 | ## User 17 | 18 | Table: `users` 19 | 20 | **Description:** 21 | 22 | The User model is for information such as the users name and email address. 23 | 24 | Email address are optional, but if one is specified for a User then it must be unique. 25 | 26 | :::note 27 | 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. 28 | 29 | 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). 30 | ::: 31 | 32 | ## Account 33 | 34 | Table: `accounts` 35 | 36 | **Description:** 37 | 38 | The Account model is for information about OAuth accounts associated with a User. 39 | 40 | A single User can have multiple Accounts, each Account can only have one User. 41 | 42 | ## Session 43 | 44 | Table: `sessions` 45 | 46 | **Description:** 47 | 48 | The Session model is used for database sessions. It is not used if JSON Web Tokens are enabled. 49 | 50 | A single User can have multiple Sessions, each Session can only have one User. 51 | 52 | ## Verification Request 53 | 54 | Table: `verification_requests` 55 | 56 | **Description:** 57 | 58 | The Verification Request model is used to store tokens for passwordless sign in emails. 59 | 60 | A single User can have multiple open Verification Requests (e.g. to sign in to different devices). 61 | 62 | It has been designed to be extendable for other verification purposes in future (e.g. 2FA / short codes). 63 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: overview 3 | title: Overview 4 | --- 5 | 6 | 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. 7 | 8 | The adapters can be found in their own repository under [`nextauthjs/adapters`](https://github.com/nextauthjs/adapters). 9 | 10 | There you can find the following adapters: 11 | 12 | - [`typeorm-legacy`](./typeorm/typeorm-overview) 13 | - [`prisma`](./prisma) 14 | - [`prisma-legacy`](./prisma-legacy) 15 | - [`fauna`](./fauna) 16 | - [`dynamodb`](./dynamodb) 17 | - [`firebase`](./firebase) 18 | 19 | ## Custom Adapter 20 | 21 | 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. 22 | 23 | ### Editor integration 24 | 25 | 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: 26 | 27 | ```js 28 | /** @type { import("next-auth/adapters").Adapter } */ 29 | const MyAdapter = () => { 30 | return { 31 | async getAdapter() { 32 | return { 33 | // your adapter methods here 34 | } 35 | }, 36 | } 37 | } 38 | ``` 39 | 40 | :::note 41 | 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. 42 | ::: 43 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/pouchdb.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: pouchdb 3 | title: PouchDB Adapter 4 | --- 5 | 6 | # PouchDB 7 | 8 | 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. 9 | 10 | 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, ...) 11 | 12 | ## Getting Started 13 | 14 | > **Prerequesite**: Your PouchDB instance MUST provide the `pouchdb-find` plugin since it is used internally by the adapter to build and manage indexes 15 | 16 | 1. Install `next-auth` and `@next-auth/pouchdb-adapter@canary` 17 | 18 | ```js 19 | npm install next-auth @next-auth/pouchdb-adapter@canary 20 | ``` 21 | 22 | 2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object 23 | 24 | ```javascript title="pages/api/auth/[...nextauth].js" 25 | import NextAuth from "next-auth" 26 | import Providers from "next-auth/providers" 27 | import { PouchDBAdapter } from "@next-auth/pouchdb-adapter" 28 | import PouchDB from "pouchdb" 29 | 30 | // Setup your PouchDB instance and database 31 | PouchDB.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter 32 | .plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin 33 | 34 | const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" }) 35 | 36 | // For more information on each option (and a full list of options) go to 37 | // https://next-auth.js.org/configuration/options 38 | export default NextAuth({ 39 | // https://next-auth.js.org/configuration/providers 40 | providers: [ 41 | Providers.Google({ 42 | clientId: process.env.GOOGLE_ID, 43 | clientSecret: process.env.GOOGLE_SECRET, 44 | }), 45 | ], 46 | adapter: PouchDBAdapter(pouchdb), 47 | // ... 48 | }) 49 | ``` 50 | 51 | ## Advanced 52 | 53 | ### Memory-First Caching Strategy 54 | 55 | 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. 56 | 57 | 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. 58 | 59 | This will most likely not increase performance much in a serverless environment due to various reasons such as concurrency, function startup time increases, etc. 60 | 61 | For more details, please see https://pouchdb.com/api.html#sync 62 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/typeorm/mongodb.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mongodb 3 | title: MongoDB 4 | --- 5 | 6 | MongoDB is a document database and does not use schemas in the same way as most RDBMS databases. 7 | 8 | **In MongoDB as collections and indexes are created automatically.** 9 | 10 | ## Objects in MongoDB 11 | 12 | Objects stored in MongoDB use similar datatypes to SQL, with some differences: 13 | 14 | 1. ID fields are of type `ObjectID` rather than type `int`. 15 | 16 | 2. All collection names and property names use `camelCase` rather than `snake_case`. 17 | 18 | 3. All timestamps are stored as `ISODate()` in MongoDB and all date/time values are stored in UTC. 19 | 20 | 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. 21 | 22 | This is functionally equivalent to the ANSI SQL behaviour for a `unique` but `nullable` property. 23 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/typeorm/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: typeorm-overview 3 | title: Overview 4 | --- 5 | 6 | ## TypeORM Adapter 7 | 8 | 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. 9 | 10 | ### Database Schemas 11 | 12 | Configure your database by creating the tables and columns to match the schema expected by NextAuth.js. 13 | 14 | - [MySQL Schema](./mysql) 15 | - [Postgres Schema](./postgres) 16 | - [Microsoft SQL Server Schema](./mssql) 17 | - [MongoDB](./mongodb) 18 | 19 | The default Adapter is the TypeORM Adapter and the default database type for TypeORM is SQLite, the following configuration options are exactly equivalent. 20 | 21 | ```javascript 22 | database: { 23 | type: 'sqlite', 24 | database: ':memory:', 25 | synchronize: true 26 | } 27 | ``` 28 | 29 | ```javascript 30 | adapter: Adapters.Default({ 31 | type: "sqlite", 32 | database: ":memory:", 33 | synchronize: true, 34 | }) 35 | ``` 36 | 37 | ```javascript 38 | adapter: Adapters.TypeORM.Adapter({ 39 | type: "sqlite", 40 | database: ":memory:", 41 | synchronize: true, 42 | }) 43 | ``` 44 | 45 | The tutorial [Custom models with TypeORM](/v3/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. 46 | 47 | :::tip 48 | 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! 49 | ::: 50 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/adapters/typeorm/postgres.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: postgres 3 | title: Postgres 4 | --- 5 | 6 | Schema for a Postgres database. 7 | 8 | :::note 9 | 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. 10 | 11 | This transform is also applied to any properties of type `timestamp` when using custom models. 12 | ::: 13 | 14 | ```sql 15 | CREATE TABLE accounts 16 | ( 17 | id SERIAL, 18 | compound_id VARCHAR(255) NOT NULL, 19 | user_id INTEGER NOT NULL, 20 | provider_type VARCHAR(255) NOT NULL, 21 | provider_id VARCHAR(255) NOT NULL, 22 | provider_account_id VARCHAR(255) NOT NULL, 23 | refresh_token TEXT, 24 | access_token TEXT, 25 | access_token_expires TIMESTAMPTZ, 26 | created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 27 | updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 28 | PRIMARY KEY (id) 29 | ); 30 | 31 | CREATE TABLE sessions 32 | ( 33 | id SERIAL, 34 | user_id INTEGER NOT NULL, 35 | expires TIMESTAMPTZ NOT NULL, 36 | session_token VARCHAR(255) NOT NULL, 37 | access_token VARCHAR(255) NOT NULL, 38 | created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 39 | updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 40 | PRIMARY KEY (id) 41 | ); 42 | 43 | CREATE TABLE users 44 | ( 45 | id SERIAL, 46 | name VARCHAR(255), 47 | email VARCHAR(255), 48 | email_verified TIMESTAMPTZ, 49 | image TEXT, 50 | created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 51 | updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 52 | PRIMARY KEY (id) 53 | ); 54 | 55 | CREATE TABLE verification_requests 56 | ( 57 | id SERIAL, 58 | identifier VARCHAR(255) NOT NULL, 59 | token VARCHAR(255) NOT NULL, 60 | expires TIMESTAMPTZ NOT NULL, 61 | created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 62 | updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, 63 | PRIMARY KEY (id) 64 | ); 65 | 66 | CREATE UNIQUE INDEX compound_id 67 | ON accounts(compound_id); 68 | 69 | CREATE INDEX provider_account_id 70 | ON accounts(provider_account_id); 71 | 72 | CREATE INDEX provider_id 73 | ON accounts(provider_id); 74 | 75 | CREATE INDEX user_id 76 | ON accounts(user_id); 77 | 78 | CREATE UNIQUE INDEX session_token 79 | ON sessions(session_token); 80 | 81 | CREATE UNIQUE INDEX access_token 82 | ON sessions(access_token); 83 | 84 | CREATE UNIQUE INDEX email 85 | ON users(email); 86 | 87 | CREATE UNIQUE INDEX token 88 | ON verification_requests(token); 89 | 90 | ``` 91 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/configuration/events.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: events 3 | title: Events 4 | --- 5 | 6 | Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting. 7 | 8 | You can specify a handler for any of these events below, for debugging or for an audit log. 9 | 10 | :::note 11 | 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. 12 | ::: 13 | 14 | ## Events 15 | 16 | ### signIn 17 | 18 | Sent on successful sign in. 19 | 20 | The message will be an object and contain: 21 | 22 | - `user` (from your adapter or from the provider if a `credentials` type provider) 23 | - `account` (from your adapter or the provider) 24 | - `isNewUser` (whether your adapter had a user for this account already) 25 | 26 | ### signOut 27 | 28 | Sent when the user signs out. 29 | 30 | The message object is the JWT, if using them, or the adapter session object for the session that is being ended. 31 | 32 | ### createUser 33 | 34 | Sent when the adapter is told to create a new user. 35 | 36 | The message object will be the user. 37 | 38 | ### updateUser 39 | 40 | Sent when the adapter is told to update an existing user. Currently this is only sent when the user verifies their email address. 41 | 42 | The message object will be the user. 43 | 44 | ### linkAccount 45 | 46 | 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. 47 | 48 | The message will be an object and contain: 49 | 50 | - `user`: The user object from your adapter 51 | - `providerAccount`: The object returned from the provider. 52 | 53 | ### session 54 | 55 | Sent at the end of a request for the current session. 56 | 57 | The message will be an object and contain: 58 | 59 | - `session`: The session object from your adapter 60 | - `jwt`: If using JWT, the token for this session. 61 | 62 | ### error 63 | 64 | Sent when an error occurs 65 | 66 | The message could be any object relevant to describing the error. 67 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/contributors.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: contributors 3 | title: Contributors 4 | --- 5 | 6 | ## Core Team 7 | 8 | - [Iain Collins](https://github.com/iaincollins) 9 | - [Lori Karikari](https://github.com/LoriKarikari) 10 | - [Nico Domino](https://github.com/ndom91) 11 | - [Fredrik Pettersen](https://github.com/Fumler) 12 | - [Gerald Nolan](https://github.com/geraldnolan) 13 | - [Lluis Agusti](https://github.com/lluia) 14 | - [Jefferson Bledsoe](https://github.com/JeffersonBledsoe) 15 | - [Balázs Orbán](https://github.com/sponsors/balazsorban44) 16 | 17 | _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._ 18 | 19 | ## Other Contributors 20 | 21 | NextAuth.js as it exists today has been possible thanks to the work of many individual contributors. 22 | 23 | Thank you to the [dozens of individual contributors](https://github.com/nextauthjs/next-auth/graphs/contributors) who have help shaped NextAuth.js. 24 | 25 | ## History 26 | 27 | NextAuth.js was originally developed by <a href="https://github.com/iaincollins">Iain Collins</a> in 2016. 28 | 29 | 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. 30 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/getting-started/rest-api.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: rest-api 3 | title: REST API 4 | --- 5 | 6 | NextAuth.js exposes a REST API which is used by the NextAuth.js client. 7 | 8 | #### `GET` /api/auth/signin 9 | 10 | Displays the sign in page. 11 | 12 | #### `POST` /api/auth/signin/:provider 13 | 14 | Starts an OAuth signin flow for the specified provider. 15 | 16 | The POST submission requires CSRF token from `/api/auth/csrf`. 17 | 18 | #### `GET` /api/auth/callback/:provider 19 | 20 | Handles returning requests from OAuth services during sign in. 21 | 22 | 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. 23 | 24 | #### `GET` /api/auth/signout 25 | 26 | Displays the sign out page. 27 | 28 | #### `POST` /api/auth/signout 29 | 30 | Handles signing out - this is a `POST` submission to prevent malicious links from triggering signing a user out without their consent. 31 | 32 | The `POST` submission requires CSRF token from `/api/auth/csrf`. 33 | 34 | #### `GET` /api/auth/session 35 | 36 | Returns client-safe session object - or an empty object if there is no session. 37 | 38 | The contents of the session object that is returned are configurable with the session callback. 39 | 40 | #### `GET` /api/auth/csrf 41 | 42 | 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. 43 | 44 | The CSRF token returned by this endpoint must be passed as form variable named `csrfToken` in all `POST` submissions to any API endpoint. 45 | 46 | #### `GET` /api/auth/providers 47 | 48 | Returns a list of configured OAuth services and details (e.g. sign in and callback URLs) for each service. 49 | 50 | 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. 51 | 52 | --- 53 | 54 | :::note 55 | The default base path is `/api/auth` but it is configurable by specifying a custom path in `NEXTAUTH_URL` 56 | 57 | e.g. 58 | 59 | `NEXTAUTH_URL=https://example.com/myapp/api/authentication` 60 | 61 | `/api/auth/signin` -> `/myapp/api/authentication/signin` 62 | ::: 63 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/42.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: 42-school 3 | title: 42 School 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://api.intra.42.fr/apidoc/guides/web_application_flow 9 | 10 | ## Configuration 11 | 12 | https://profile.intra.42.fr/oauth/applications/new 13 | 14 | ## Options 15 | 16 | The **42 School Provider** comes with a set of default options: 17 | 18 | - [42 School Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/42.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.FortyTwo({ 29 | clientId: process.env.FORTY_TWO_CLIENT_ID, 30 | clientSecret: process.env.FORTY_TWO_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/atlassian.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: atlassian 3 | title: Atlassian 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo- 9 | 10 | ## Options 11 | 12 | The **Atlassian Provider** comes with a set of default options: 13 | 14 | - [Atlassian Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/atlassian.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from `next-auth/providers` 22 | ... 23 | providers: [ 24 | Providers.Atlassian({ 25 | clientId: process.env.ATLASSIAN_CLIENT_ID, 26 | clientSecret: process.env.ATLASSIAN_CLIENT_SECRET, 27 | scope: 'write:jira-work read:jira-work read:jira-user offline_access read:me' 28 | }) 29 | ] 30 | ... 31 | ``` 32 | 33 | ## Instructions 34 | 35 | ### Configuration 36 | 37 | :::tip 38 | An app can be created at https://developer.atlassian.com/apps/ 39 | ::: 40 | 41 | Under "Apis and features" in the side menu, configure the following for "OAuth 2.0 (3LO)": 42 | 43 | - Redirect URL 44 | - http://localhost:3000/api/auth/callback/atlassian 45 | 46 | :::warning 47 | To enable access to Jira Platform REST API you must enable User Identity API and add `read:me` to your provider scope option. 48 | ::: 49 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/auth0.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: auth0 3 | title: Auth0 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://auth0.com/docs/api/authentication#authorize-application 9 | 10 | ## Configuration 11 | 12 | https://manage.auth0.com/dashboard 13 | 14 | :::tip 15 | Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App'). 16 | ::: 17 | 18 | ## Options 19 | 20 | The **Auth0 Provider** comes with a set of default options: 21 | 22 | - [Auth0 Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/auth0.js) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import Providers from `next-auth/providers` 30 | ... 31 | providers: [ 32 | Providers.Auth0({ 33 | clientId: process.env.AUTH0_CLIENT_ID, 34 | clientSecret: process.env.AUTH0_CLIENT_SECRET, 35 | domain: process.env.AUTH0_DOMAIN 36 | }) 37 | ] 38 | ... 39 | ``` 40 | 41 | :::note 42 | `domain` should be the fully qualified domain – e.g. `dev-s6clz2lv.eu.auth0.com` 43 | ::: 44 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/azure-ad-b2c.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: azure-ad-b2c 3 | title: Azure Active Directory B2C 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow 9 | 10 | ## Configuration 11 | 12 | https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant 13 | 14 | ## Options 15 | 16 | The **Azure Active Directory Provider** comes with a set of default options: 17 | 18 | - [Azure Active Directory Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/azure-ad-b2c.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | - In https://portal.azure.com/ -> Azure Active Directory create a new App Registration. 25 | - Make sure to remember / copy 26 | - Application (client) ID 27 | - Directory (tenant) ID 28 | - When asked for a redirection URL, use http://localhost:3000/api/auth/callback/azure-ad-b2c 29 | - Create a new secret and remember / copy its value immediately, it will disappear. 30 | 31 | In `.env.local` create the following entries: 32 | 33 | ``` 34 | AZURE_CLIENT_ID=<copy Application (client) ID here> 35 | AZURE_CLIENT_SECRET=<copy generated secret value here> 36 | AZURE_TENANT_ID=<copy the tenant id here> 37 | ``` 38 | 39 | In `pages/api/auth/[...nextauth].js` find or add the AZURE entries: 40 | 41 | ```js 42 | import Providers from 'next-auth/providers'; 43 | ... 44 | providers: [ 45 | Providers.AzureADB2C({ 46 | clientId: process.env.AZURE_CLIENT_ID, 47 | clientSecret: process.env.AZURE_CLIENT_SECRET, 48 | scope: 'offline_access User.Read', 49 | tenantId: process.env.AZURE_TENANT_ID, 50 | }), 51 | ] 52 | ... 53 | 54 | ``` 55 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/basecamp.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: basecamp 3 | title: Basecamp 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://github.com/basecamp/api/blob/master/sections/authentication.md 9 | 10 | ## Configuration 11 | 12 | https://launchpad.37signals.com/integrations 13 | 14 | ## Options 15 | 16 | The **Basecamp Provider** comes with a set of default options: 17 | 18 | - [Basecamp Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/basecamp.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Examples 23 | 24 | ### Basic profile information 25 | 26 | ```js 27 | import Providers from `next-auth/providers` 28 | ... 29 | providers: [ 30 | Providers.Basecamp({ 31 | clientId: process.env.BASECAMP_CLIENT_ID, 32 | clientSecret: process.env.BASECAMP_CLIENT_SECRET 33 | }) 34 | ] 35 | ... 36 | ``` 37 | 38 | :::note 39 | 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. 40 | ::: 41 | 42 | ### Profile information in relation to specific team 43 | 44 | ```js 45 | import Providers from `next-auth/providers` 46 | ... 47 | providers: [ 48 | Providers.Basecamp({ 49 | clientId: process.env.BASECAMP_CLIENT_ID, 50 | clientSecret: process.env.BASECAMP_CLIENT_SECRET, 51 | profileUrl: `https://3.basecampapi.com/${process.env.BASECAMP_TEAM_ID}/my/profile.json`, 52 | profile: (profile) => { 53 | return { 54 | id: profile.id, 55 | name: profile.name, 56 | email: profile.email_address, 57 | image: profile.avatar_url, 58 | admin: profile.admin, 59 | owner: profile.owner 60 | } 61 | } 62 | }) 63 | ] 64 | ... 65 | ``` 66 | 67 | :::tip 68 | 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 69 | ::: 70 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/battlenet.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: battle.net 3 | title: Battle.net 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://develop.battle.net/documentation/guides/using-oauth 9 | 10 | ## Configuration 11 | 12 | https://develop.battle.net/access/clients 13 | 14 | ## Options 15 | 16 | The **Battle.net Provider** comes with a set of default options: 17 | 18 | - [Battle.net Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/battlenet.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.BattleNet({ 29 | clientId: process.env.BATTLENET_CLIENT_ID, 30 | clientSecret: process.env.BATTLENET_CLIENT_SECRET, 31 | region: process.env.BATTLENET_REGION 32 | }) 33 | ] 34 | ... 35 | ``` 36 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/box.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: box 3 | title: Box 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.box.com/reference/ 9 | 10 | ## Configuration 11 | 12 | https://developer.box.com/guides/sso-identities-and-app-users/connect-okta-to-app-users/configure-box/ 13 | 14 | ## Options 15 | 16 | The **Box Provider** comes with a set of default options: 17 | 18 | - [Box Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/box.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Box({ 29 | clientId: process.env.BOX_CLIENT_ID, 30 | clientSecret: process.env.BOX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/cognito.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cognito 3 | title: Amazon Cognito 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html 9 | 10 | ## Configuration 11 | 12 | https://console.aws.amazon.com/cognito/users/ 13 | 14 | You need to select your AWS region to go the the Cognito dashboard. 15 | 16 | ## Options 17 | 18 | The **Amazon Cognito Provider** comes with a set of default options: 19 | 20 | - [Amazon Cognito Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/cognito.js) 21 | 22 | You can override any of the options to suit your own use case. 23 | 24 | ## Example 25 | 26 | ```js 27 | import Providers from `next-auth/providers` 28 | ... 29 | providers: [ 30 | Providers.Cognito({ 31 | clientId: process.env.COGNITO_CLIENT_ID, 32 | clientSecret: process.env.COGNITO_CLIENT_SECRET, 33 | domain: process.env.COGNITO_DOMAIN, 34 | }) 35 | ] 36 | ... 37 | ``` 38 | 39 | :::warning 40 | Make sure you select all the appropriate client settings or the OAuth flow will not work. 41 | ::: 42 | 43 | ![cognito](https://user-images.githubusercontent.com/7902980/83951604-cd096e80-a832-11ea-8bd2-c496ec9a16cb.PNG) 44 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/coinbase.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: coinbase 3 | title: Coinbase 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.coinbase.com/api/v2 9 | 10 | ## Configuration 11 | 12 | https://www.coinbase.com/settings/api 13 | 14 | ## Options 15 | 16 | The **Coinbase Provider** comes with a set of default options: 17 | 18 | - [Coinbase Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/coinbase.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Coinbase({ 29 | clientId: process.env.COINBASE_CLIENT_ID, 30 | clientSecret: process.env.COINBASE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | This Provider template has a 2 hour access token to it. A refresh token is also returned. 38 | ::: 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/discord.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: discord 3 | title: Discord 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://discord.com/developers/docs/topics/oauth2 9 | 10 | ## Configuration 11 | 12 | https://discord.com/developers/applications 13 | 14 | ## Options 15 | 16 | The **Discord Provider** comes with a set of default options: 17 | 18 | - [Discord Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/discord.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Discord({ 29 | clientId: process.env.DISCORD_CLIENT_ID, 30 | clientSecret: process.env.DISCORD_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/dropbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: dropbox 3 | title: Dropbox 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.dropbox.com/oauth-guide 9 | 10 | ## Configuration 11 | 12 | https://www.dropbox.com/developers/apps 13 | 14 | ## Options 15 | 16 | The **Dropbox Provider** comes with a set of default options: 17 | 18 | - [Dropbox Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/dropbox.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Dropbox({ 29 | clientId: process.env.DROPBOX_CLIENT_ID, 30 | clientSecret: process.env.DROPBOX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/eveonline.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: eveonline 3 | title: EVE Online 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.eveonline.com/blog/article/sso-to-authenticated-calls 9 | 10 | ## Configuration 11 | 12 | https://developers.eveonline.com/ 13 | 14 | ## Options 15 | 16 | The **EVE Online Provider** comes with a set of default options: 17 | 18 | - [EVE Online Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/eveonline.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.EVEOnline({ 29 | clientId: process.env.EVE_CLIENT_ID, 30 | clientSecret: process.env.EVE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip When creating your application, make sure to select `Authentication Only` as the connection type. 37 | 38 | :::tip If using JWT for the session, you can add the `CharacterID` to the JWT token and session. Example: 39 | 40 | ```js 41 | ... 42 | options: { 43 | jwt: { 44 | secret: process.env.JWT_SECRET, 45 | }, 46 | callbacks: { 47 | jwt: async (token, user, account, profile, isNewUser) => { 48 | if (profile) { 49 | token = { 50 | ...token, 51 | id: profile.CharacterID, 52 | } 53 | } 54 | return token; 55 | }, 56 | session: async (session, token) => { 57 | if (token) { 58 | session.user.id = token.id; 59 | } 60 | return session; 61 | } 62 | } 63 | } 64 | ... 65 | ``` 66 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/facebook.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: facebook 3 | title: Facebook 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ 9 | 10 | ## Configuration 11 | 12 | https://developers.facebook.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Facebook Provider** comes with a set of default options: 17 | 18 | - [Facebook Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/facebook.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Facebook({ 29 | clientId: process.env.FACEBOOK_CLIENT_ID, 30 | clientSecret: process.env.FACEBOOK_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | 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. 38 | ::: 39 | 40 | :::tip 41 | Email address may not be returned for accounts created on mobile. 42 | ::: 43 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/faceit.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: faceit 3 | title: FACEIT 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf 9 | 10 | ## Configuration 11 | 12 | https://developers.faceit.com/apps 13 | 14 | Grant type: `Authorization Code` 15 | 16 | Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile` 17 | 18 | ## Options 19 | 20 | The **FACEIT Provider** comes with a set of default options: 21 | 22 | - [FACEIT Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/faceit.js) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import Providers from `next-auth/providers` 30 | ... 31 | providers: [ 32 | Providers.FACEIT({ 33 | clientId: process.env.FACEIT_CLIENT_ID, 34 | clientSecret: process.env.FACEIT_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/foursquare.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: foursquare 3 | title: Foursquare 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.foursquare.com/docs/places-api/authentication/#web-applications 9 | 10 | ## Configuration 11 | 12 | https://developer.foursquare.com/ 13 | 14 | :::warning 15 | 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". 16 | 17 | ## Options 18 | 19 | The **Foursquare Provider** comes with a set of default options: 20 | 21 | - [Foursquare Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/foursquare.js) 22 | 23 | You can override any of the options to suit your own use case. 24 | 25 | ## Example 26 | 27 | ```js 28 | import Providers from `next-auth/providers` 29 | ... 30 | providers: [ 31 | Providers.Foursquare({ 32 | clientId: process.env.FOURSQUARE_CLIENT_ID, 33 | clientSecret: process.env.FOURSQUARE_CLIENT_SECRET, 34 | apiVersion: 'YYYYMMDD' 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/fusionauth.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fusionauth 3 | title: FusionAuth 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://fusionauth.io/docs/v1/tech/oauth/ 9 | 10 | ## Options 11 | 12 | The **FusionAuth Provider** comes with a set of default options: 13 | 14 | - [FusionAuth Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/fusionauth.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from `next-auth/providers` 22 | ... 23 | providers: [ 24 | Providers.FusionAuth({ 25 | id: "fusionauth", 26 | name: "FusionAuth", 27 | domain: process.env.FUSIONAUTH_DOMAIN, 28 | clientId: process.env.FUSIONAUTH_CLIENT_ID, 29 | clientSecret: process.env.FUSIONAUTH_SECRET, 30 | tenantId: process.env.FUSIONAUTH_TENANT_ID // Only required if you're using multi-tenancy 31 | }), 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | If you're using multi-tenancy, you need to pass in the `tenantId` option to apply the proper theme. 38 | ::: 39 | 40 | ## Instructions 41 | 42 | ### Configuration 43 | 44 | :::tip 45 | An application can be created at https://your-fusionauth-server-url/admin/application. 46 | 47 | For more information, follow the [FusionAuth 5-minute setup guide](https://fusionauth.io/docs/v1/tech/5-minute-setup-guide). 48 | ::: 49 | 50 | In the OAuth settings for your application, configure the following. 51 | 52 | - Redirect URL 53 | - https://localhost:3000/api/auth/callback/fusionauth 54 | - Enabled grants 55 | - Make sure _Authorization Code_ is enabled. 56 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/github.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: github 3 | title: GitHub 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps 9 | 10 | ## Configuration 11 | 12 | https://github.com/settings/apps 13 | 14 | ## Options 15 | 16 | The **Github Provider** comes with a set of default options: 17 | 18 | - [Github Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/github.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.GitHub({ 29 | clientId: process.env.GITHUB_CLIENT_ID, 30 | clientSecret: process.env.GITHUB_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Only allows one callback URL per Client ID / Client Secret. 38 | ::: 39 | 40 | :::tip 41 | Email address is not returned if privacy settings are enabled. 42 | ::: 43 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/gitlab.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: gitlab 3 | title: GitLab 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.gitlab.com/ee/api/oauth2.html 9 | 10 | ## Configuration 11 | 12 | https://gitlab.com/profile/applications 13 | 14 | ## Options 15 | 16 | The **Gitlab Provider** comes with a set of default options: 17 | 18 | - [Gitlab Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/gitlab.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.GitLab({ 29 | clientId: process.env.GITLAB_CLIENT_ID, 30 | clientSecret: process.env.GITLAB_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | Enable the _"read_user"_ option in scope if you want to save the users email address on sign up. 38 | ::: 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/google.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: google 3 | title: Google 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.google.com/identity/protocols/oauth2 9 | 10 | ## Configuration 11 | 12 | https://console.developers.google.com/apis/credentials 13 | 14 | ## Options 15 | 16 | The **Google Provider** comes with a set of default options: 17 | 18 | - [Google Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/google.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Google({ 29 | clientId: process.env.GOOGLE_CLIENT_ID, 30 | clientSecret: process.env.GOOGLE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Google only provide the Refresh Token to an application the first time a user signs in. 38 | 39 | To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again: 40 | https://myaccount.google.com/permissions 41 | 42 | 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. 43 | 44 | 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. 45 | 46 | ```js 47 | const options = { 48 | ... 49 | providers: [ 50 | Providers.Google({ 51 | clientId: process.env.GOOGLE_ID, 52 | clientSecret: process.env.GOOGLE_SECRET, 53 | authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&response_type=code', 54 | }) 55 | ], 56 | ... 57 | } 58 | ``` 59 | 60 | ::: 61 | 62 | :::tip 63 | Google also return an `verified_email` boolean property in the OAuth profile. 64 | 65 | You can use this property to restrict access to people with verified accounts at a particular domain. 66 | 67 | ```js 68 | const options = { 69 | ... 70 | callbacks: { 71 | async signIn(user, account, profile) { 72 | if (account.provider === 'google' && 73 | profile.verified_email === true && 74 | profile.email.endsWith('@example.com')) { 75 | return true 76 | } else { 77 | return false 78 | } 79 | }, 80 | } 81 | ... 82 | } 83 | ``` 84 | 85 | ::: 86 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/identity-server4.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: identity-server4 3 | title: IdentityServer4 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://identityserver4.readthedocs.io/en/latest/ 9 | 10 | ## Options 11 | 12 | The **IdentityServer4 Provider** comes with a set of default options: 13 | 14 | - [IdentityServer4 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/identity-server4.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from `next-auth/providers` 22 | ... 23 | providers: [ 24 | Providers.IdentityServer4({ 25 | id: "identity-server4", 26 | name: "IdentityServer4", 27 | scope: "openid profile email api offline_access", // Allowed Scopes 28 | domain: process.env.IdentityServer4_Domain, 29 | clientId: process.env.IdentityServer4_CLIENT_ID, 30 | clientSecret: process.env.IdentityServer4_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | ## Demo IdentityServer 37 | 38 | The configuration below is for the demo server at https://demo.identityserver.io/ 39 | 40 | If you want to try it out, you can copy and paste the configuration below. 41 | 42 | You can sign in to the demo service with either <b>bob/bob</b> or <b>alice/alice</b>. 43 | 44 | ```js 45 | import Providers from `next-auth/providers` 46 | ... 47 | providers: [ 48 | Providers.IdentityServer4({ 49 | id: "demo-identity-server", 50 | name: "Demo IdentityServer4", 51 | scope: "openid profile email api offline_access", 52 | domain: "demo.identityserver.io", 53 | clientId: "interactive.confidential", 54 | clientSecret: "secret", 55 | protection: "pkce" 56 | }) 57 | } 58 | ... 59 | ``` 60 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/instagram.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: instagram 3 | title: Instagram 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.facebook.com/docs/instagram-basic-display-api/getting-started 9 | 10 | ## Configuration 11 | 12 | https://developers.facebook.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Instagram Provider** comes with a set of default options: 17 | 18 | - [Instagram Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/instagram.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```jsx 25 | // pages/api/auth/[...nextauth].js 26 | import Providers from `next-auth/providers` 27 | ... 28 | providers: [ 29 | Providers.Instagram({ 30 | clientId: process.env.INSTAGRAM_CLIENT_ID, 31 | clientSecret: process.env.INSTAGRAM_CLIENT_SECRET 32 | }) 33 | ] 34 | ... 35 | // pages/index.jsx 36 | import { signIn } from "next-auth/client" 37 | ... 38 | <button onClick={() => signIn("instagram")}> 39 | Sign in 40 | </button> 41 | ... 42 | ``` 43 | 44 | :::warning 45 | Email address is not returned by the Instagram API. 46 | ::: 47 | 48 | :::tip 49 | 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). 50 | ::: 51 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/kakao.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: kakao 3 | title: Kakao 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.kakao.com/product/kakaoLogin 9 | 10 | ## Configuration 11 | 12 | https://developers.kakao.com/docs/latest/en/kakaologin/common 13 | 14 | ## Options 15 | 16 | The **Kakao Provider** comes with a set of default options: 17 | 18 | - [Kakao Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/kakao.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Kakao({ 29 | clientId: process.env.KAKAO_CLIENT_ID, 30 | clientSecret: process.env.KAKAO_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | ## Instructions 37 | 38 | ### Configuration 39 | 40 | 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. 41 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/line.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: line 3 | title: LINE 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.line.biz/en/docs/line-login/integrate-line-login/ 9 | 10 | ## Configuration 11 | 12 | https://developers.line.biz/console/ 13 | 14 | ## Options 15 | 16 | The **Line Provider** comes with a set of default options: 17 | 18 | - [Line Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/line.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.LINE({ 29 | clientId: process.env.LINE_CLIENT_ID, 30 | clientSecret: process.env.LINE_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | ## Instructions 37 | 38 | ### Configuration 39 | 40 | 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: 41 | 42 | - Callback URL 43 | - http://localhost:3000/api/auth/callback/line 44 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/linkedin.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: linkedin 3 | title: LinkedIn 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow 9 | 10 | ## Configuration 11 | 12 | https://www.linkedin.com/developers/apps/ 13 | 14 | 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. 15 | 16 | ![image](https://user-images.githubusercontent.com/330396/114429603-68195600-9b72-11eb-8311-62e58383c42b.png) 17 | 18 | ## Options 19 | 20 | The **LinkedIn Provider** comes with a set of default options: 21 | 22 | - [LinkedIn Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/linkedin.js) 23 | 24 | You can override any of the options to suit your own use case. 25 | 26 | ## Example 27 | 28 | ```js 29 | import Providers from `next-auth/providers` 30 | ... 31 | providers: [ 32 | Providers.LinkedIn({ 33 | clientId: process.env.LINKEDIN_CLIENT_ID, 34 | clientSecret: process.env.LINKEDIN_CLIENT_SECRET 35 | }) 36 | ] 37 | ... 38 | ``` 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/mailchimp.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mailchimp 3 | title: Mailchimp 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ 9 | 10 | ## Configuration 11 | 12 | https://admin.mailchimp.com/account/oauth2/client/ 13 | 14 | ## Options 15 | 16 | The **Mailchimp Provider** comes with a set of default options: 17 | 18 | - [Mailchimp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailchimp.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Mailchimp({ 29 | clientId: process.env.MAILCHIMP_CLIENT_ID, 30 | clientSecret: process.env.MAILCHIMP_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/mailru.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mailru 3 | title: Mail.ru 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://o2.mail.ru/docs 9 | 10 | ## Configuration 11 | 12 | https://o2.mail.ru/app/ 13 | 14 | ## Options 15 | 16 | The **Mail.ru Provider** comes with a set of default options: 17 | 18 | - [Mail.ru Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/mailru.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.MailRu({ 29 | clientId: process.env.MAILRU_CLIENT_ID, 30 | clientSecret: process.env.MAILRU_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/medium.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: medium 3 | title: Medium 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://github.com/Medium/medium-api-docs 9 | 10 | ## Configuration 11 | 12 | https://medium.com/me/applications 13 | 14 | ## Options 15 | 16 | The **Medium Provider** comes with a set of default options: 17 | 18 | - [Medium Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/medium.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Medium({ 29 | clientId: process.env.MEDIUM_CLIENT_ID, 30 | clientSecret: process.env.MEDIUM_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Email address is not returned by the Medium API. 38 | ::: 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/naver.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: naver 3 | title: Naver 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developers.naver.com/docs/login/overview/overview.md 9 | 10 | ## Configuration 11 | 12 | https://developers.naver.com/docs/login/api/api.md 13 | 14 | ## Options 15 | 16 | The **Naver Provider** comes with a set of default options: 17 | 18 | - [Naver Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/naver.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Naver({ 29 | clientId: process.env.NAVER_CLIENT_ID, 30 | clientSecret: process.env.NAVER_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/netlify.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: netlify 3 | title: Netlify 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.netlify.com/blog/2016/10/10/integrating-with-netlify-oauth2/ 9 | 10 | ## Configuration 11 | 12 | https://github.com/netlify/netlify-oauth-example 13 | 14 | ## Options 15 | 16 | The **Netlify Provider** comes with a set of default options: 17 | 18 | - [Netlify Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/netlify.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Netlify({ 29 | clientId: process.env.NETLIFY_CLIENT_ID, 30 | clientSecret: process.env.NETLIFY_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/okta.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: okta 3 | title: Okta 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.okta.com/docs/reference/api/oidc 9 | 10 | ## Options 11 | 12 | The **Okta Provider** comes with a set of default options: 13 | 14 | - [Okta Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/okta.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from `next-auth/providers` 22 | ... 23 | providers: [ 24 | Providers.Okta({ 25 | clientId: process.env.OKTA_CLIENT_ID, 26 | clientSecret: process.env.OKTA_CLIENT_SECRET, 27 | domain: process.env.OKTA_DOMAIN 28 | }) 29 | ] 30 | ... 31 | ``` 32 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/osso.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: osso 3 | title: Osso 4 | --- 5 | 6 | ## Documentation 7 | 8 | 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. 9 | 10 | 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/ 11 | 12 | ## Configuration 13 | 14 | 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. 15 | 16 | [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. 17 | 18 | See Osso's complete configuration and testing documentation at https://ossoapp.com/docs/configure/overview 19 | 20 | ## Options 21 | 22 | The **Osso Provider** comes with a set of default options: 23 | 24 | - [Osso Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/osso.js) 25 | 26 | You can override any of the options to suit your own use case. 27 | 28 | ## Example 29 | 30 | A full example application is available at https://github.com/enterprise-oss/osso-next-auth-example and https://nextjs-demo.ossoapp.com 31 | 32 | ```js 33 | import Providers from `next-auth/providers` 34 | ... 35 | providers: [ 36 | Providers.Osso({ 37 | clientId: process.env.OSSO_CLIENT_ID, 38 | clientSecret: process.env.OSSO_CLIENT_SECRET, 39 | domain: process.env.OSSO_DOMAIN 40 | }) 41 | } 42 | ... 43 | ``` 44 | 45 | :::note 46 | `domain` should be the fully qualified domain – e.g. `demo.ossoapp.com` 47 | ::: 48 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/reddit.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: reddit 3 | title: Reddit 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.reddit.com/dev/api/ 9 | 10 | ## Configuration 11 | 12 | https://www.reddit.com/prefs/apps/ 13 | 14 | ## Options 15 | 16 | The **Reddit Provider** comes with a set of default options: 17 | 18 | - [Reddit Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/reddit.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Reddit({ 29 | clientId: process.env.REDDIT_CLIENT_ID, 30 | clientSecret: process.env.REDDIT_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::warning 37 | Reddit requires authorization every time you go through their page. 38 | ::: 39 | 40 | :::warning 41 | Only allows one callback URL per Client ID / Client Secret. 42 | ::: 43 | 44 | :::tip 45 | 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: 46 | 47 | ```js 48 | providers: [ 49 | { 50 | id: "reddit", 51 | name: "Reddit", 52 | clientId: process.env.REDDIT_CLIENT_ID, 53 | clientSecret: process.env.REDDIT_CLIENT_SECRET, 54 | scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required. 55 | type: "oauth", 56 | version: "2.0", 57 | params: { grant_type: "authorization_code" }, 58 | accessTokenUrl: " https://www.reddit.com/api/v1/access_token", 59 | authorizationUrl: 60 | "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent", 61 | profileUrl: "https://oauth.reddit.com/api/v1/me", 62 | profile: (profile) => { 63 | return { 64 | id: profile.id, 65 | name: profile.name, 66 | email: null, 67 | } 68 | }, 69 | }, 70 | ] 71 | ``` 72 | 73 | ::: 74 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/salesforce.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: salesforce 3 | title: Salesforce 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&type=5 9 | 10 | ## Options 11 | 12 | The **Salesforce Provider** comes with a set of default options: 13 | 14 | - [Salesforce Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/salesforce.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from `next-auth/providers` 22 | ... 23 | providers: [ 24 | Providers.Salesforce({ 25 | clientId: process.env.SALESFORCE_CLIENT_ID, 26 | clientSecret: process.env.SALESFORCE_CLIENT_SECRET, 27 | }) 28 | ] 29 | ... 30 | ``` 31 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/slack.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: slack 3 | title: Slack 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://api.slack.com/authentication 9 | https://api.slack.com/docs/sign-in-with-slack 10 | 11 | ## Configuration 12 | 13 | https://api.slack.com/apps 14 | 15 | ## Options 16 | 17 | The **Slack Provider** comes with a set of default options: 18 | 19 | - [Slack Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/slack.js) 20 | 21 | You can override any of the options to suit your own use case. 22 | 23 | ## Example 24 | 25 | ```js 26 | import Providers from `next-auth/providers` 27 | ... 28 | providers: [ 29 | Providers.Slack({ 30 | clientId: process.env.SLACK_CLIENT_ID, 31 | clientSecret: process.env.SLACK_CLIENT_SECRET 32 | }) 33 | ] 34 | ... 35 | ``` 36 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/spotify.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: spotify 3 | title: Spotify 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.spotify.com/documentation 9 | 10 | ## Configuration 11 | 12 | https://developer.spotify.com/dashboard/applications 13 | 14 | ## Options 15 | 16 | The **Spotify Provider** comes with a set of default options: 17 | 18 | - [Spotify Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/spotify.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Spotify({ 29 | clientId: process.env.SPOTIFY_CLIENT_ID, 30 | clientSecret: process.env.SPOTIFY_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/strava.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: strava 3 | title: Strava 4 | --- 5 | 6 | ## Documentation 7 | 8 | http://developers.strava.com/docs/reference/ 9 | 10 | ## Options 11 | 12 | The **Strava Provider** comes with a set of default options: 13 | 14 | - [Strava Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/strava.js) 15 | 16 | You can override any of the options to suit your own use case. 17 | 18 | ## Example 19 | 20 | ```js 21 | import Providers from 'next-auth/providers' 22 | ... 23 | providers: [ 24 | Providers.Strava({ 25 | clientId: process.env.STRAVA_CLIENT_ID, 26 | clientSecret: process.env.STRAVA_CLIENT_SECRET, 27 | }) 28 | ] 29 | ... 30 | ``` 31 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/twitch.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: twitch 3 | title: Twitch 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://dev.twitch.tv/docs/authentication 9 | 10 | ## Configuration 11 | 12 | https://dev.twitch.tv/console/apps 13 | 14 | Add the following redirect URL into the console `http://<your-next-app-url>/api/auth/callback/twitch` 15 | 16 | ## Options 17 | 18 | The **Twitch Provider** comes with a set of default options: 19 | 20 | - [Twitch Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/twitch.js) 21 | 22 | You can override any of the options to suit your own use case. 23 | 24 | ## Example 25 | 26 | ```js 27 | import Providers from `next-auth/providers` 28 | ... 29 | providers: [ 30 | Providers.Twitch({ 31 | clientId: process.env.TWITCH_CLIENT_ID, 32 | clientSecret: process.env.TWITCH_CLIENT_SECRET 33 | }) 34 | ] 35 | ... 36 | ``` 37 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/twitter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: twitter 3 | title: Twitter 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.twitter.com 9 | 10 | ## Configuration 11 | 12 | https://developer.twitter.com/en/apps 13 | 14 | ## Options 15 | 16 | The **Twitter Provider** comes with a set of default options: 17 | 18 | - [Twitter Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/twitter.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Twitter({ 29 | clientId: process.env.TWITTER_CLIENT_ID, 30 | clientSecret: process.env.TWITTER_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::tip 37 | You must enable the _"Request email address from users"_ option in your app permissions if you want to obtain the users email address. 38 | ::: 39 | 40 | ![twitter](https://user-images.githubusercontent.com/7902980/83944068-1640ca80-a801-11ea-959c-0e744e2144f7.PNG) 41 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/vk.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: vk 3 | title: VK 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://vk.com/dev/first_guide 9 | 10 | ## Configuration 11 | 12 | https://vk.com/apps?act=manage 13 | 14 | ## Options 15 | 16 | The **VK Provider** comes with a set of default options: 17 | 18 | - [VK Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/vk.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.VK({ 29 | clientId: process.env.VK_CLIENT_ID, 30 | clientSecret: process.env.VK_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | 36 | :::note 37 | By default the provider uses `5.126` version of the API. See https://vk.com/dev/versions for more info. 38 | ::: 39 | 40 | If you want to use a different version, you can pass it to provider's options object: 41 | 42 | ```js 43 | // pages/api/auth/[...nextauth].js 44 | 45 | const apiVersion = "5.126" 46 | ... 47 | providers: [ 48 | Providers.VK({ 49 | accessTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, 50 | requestTokenUrl: `https://oauth.vk.com/access_token?v=${apiVersion}`, 51 | authorizationUrl: 52 | `https://oauth.vk.com/authorize?response_type=code&v=${apiVersion}`, 53 | profileUrl: `https://api.vk.com/method/users.get?fields=photo_100&v=${apiVersion}`, 54 | }) 55 | ] 56 | ... 57 | ``` 58 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/wordpress.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: wordpress 3 | title: WordPress.com 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://developer.wordpress.com/docs/oauth2/ 9 | 10 | ## Configuration 11 | 12 | https://developer.wordpress.com/apps/ 13 | 14 | ## Options 15 | 16 | The **Wordpress Provider** comes with a set of default options: 17 | 18 | - [Wordpress Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/wordpress.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.WordPress({ 29 | clientId: process.env.WORDPRESS_CLIENT_ID, 30 | clientSecret: process.env.WORDPRESS_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | 36 | :::tip 37 | 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. 38 | ::: 39 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/yandex.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: yandex 3 | title: Yandex 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://tech.yandex.com/oauth/doc/dg/concepts/about-docpage/ 9 | 10 | ## Configuration 11 | 12 | https://oauth.yandex.com/client/new 13 | 14 | ## Options 15 | 16 | The **Yandex Provider** comes with a set of default options: 17 | 18 | - [Yandex Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/yandex.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Yandex({ 29 | clientId: process.env.YANDEX_CLIENT_ID, 30 | clientSecret: process.env.YANDEX_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/zoho.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: zoho 3 | title: Zoho 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://www.zoho.com/accounts/protocol/oauth/web-server-applications.html 9 | 10 | ## Configuration 11 | 12 | https://api-console.zoho.com/ 13 | 14 | ## Options 15 | 16 | The **Zoho Provider** comes with a set of default options: 17 | 18 | - [Zoho Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/zoho.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Zoho({ 29 | clientId: process.env.ZOHO_CLIENT_ID, 30 | clientSecret: process.env.ZOHO_CLIENT_SECRET 31 | }) 32 | ] 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/providers/zoom.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: zoom 3 | title: Zoom 4 | --- 5 | 6 | ## Documentation 7 | 8 | https://marketplace.zoom.us/docs/guides/auth/oauth 9 | 10 | ## Configuration 11 | 12 | https://marketplace.zoom.us 13 | 14 | ## Options 15 | 16 | The **Zoom Provider** comes with a set of default options: 17 | 18 | - [Zoom Provider options](https://github.com/nextauthjs/next-auth/blob/ead715219a5d7a6e882a6ba27fa56b03954d062d/src/providers/zoom.js) 19 | 20 | You can override any of the options to suit your own use case. 21 | 22 | ## Example 23 | 24 | ```js 25 | import Providers from `next-auth/providers` 26 | ... 27 | providers: [ 28 | Providers.Zoom({ 29 | clientId: process.env.ZOOM_CLIENT_ID, 30 | clientSecret: process.env.ZOOM_CLIENT_SECRET 31 | }) 32 | } 33 | ... 34 | ``` 35 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/tutorials/typeorm-custom-models.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: typeorm-custom-models 3 | title: Custom models with TypeORM 4 | --- 5 | 6 | NextAuth.js provides a set of [models and schemas](/adapters/models) for the built-in TypeORM adapter that you can easily extend. 7 | 8 | You can use these models with MySQL, MariaDB, Postgres, MongoDB and SQLite. 9 | 10 | ## Creating custom models 11 | 12 | ```js title="models/User.js" 13 | import Adapters from "next-auth/adapters" 14 | 15 | // Extend the built-in models using class inheritance 16 | export default class User extends Adapters.TypeORM.Models.User.model { 17 | // You can extend the options in a model but you should not remove the base 18 | // properties or change the order of the built-in options on the constructor 19 | constructor(name, email, image, emailVerified) { 20 | super(name, email, image, emailVerified) 21 | } 22 | } 23 | 24 | export const UserSchema = { 25 | name: "User", 26 | target: User, 27 | columns: { 28 | ...Adapters.TypeORM.Models.User.schema.columns, 29 | // Adds a phoneNumber to the User schema 30 | phoneNumber: { 31 | type: "varchar", 32 | nullable: true, 33 | }, 34 | }, 35 | } 36 | ``` 37 | 38 | ```js title="models/index.js" 39 | // To make importing them easier, you can export all models from single file 40 | import User, { UserSchema } from "./User" 41 | 42 | export default { 43 | User: { 44 | model: User, 45 | schema: UserSchema, 46 | }, 47 | } 48 | ``` 49 | 50 | :::note 51 | [View source for built-in TypeORM models and schemas](https://github.com/nextauthjs/adapters/tree/canary/packages/typeorm-legacy/src/models) 52 | ::: 53 | 54 | ## Using custom models 55 | 56 | You can use custom models by specifying the TypeORM adapter explicitly and passing them as an option. 57 | 58 | ```js title="pages/api/auth/[...nextauth].js" 59 | import NextAuth from "next-auth" 60 | import Providers from "next-auth/providers" 61 | import Adapters from "next-auth/adapters" 62 | 63 | import Models from "../../../models" 64 | 65 | export default NextAuth({ 66 | providers: [ 67 | // Your providers 68 | ], 69 | 70 | adapter: Adapters.TypeORM.Adapter( 71 | // The first argument should be a database connection string or TypeORM config object 72 | "mysql://username:password@127.0.0.1:3306/database_name", 73 | // The second argument can be used to pass custom models and schemas 74 | { 75 | models: { 76 | User: Models.User, 77 | }, 78 | } 79 | ), 80 | }) 81 | ``` 82 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/tutorials/usage-with-class-components.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: usage-with-class-components 3 | title: Usage with class components 4 | --- 5 | 6 | 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. 7 | 8 | ## Higher Order Component 9 | 10 | ```js 11 | import { useSession } from "next-auth/client" 12 | 13 | const withSession = (Component) => (props) => { 14 | const [session, loading] = useSession() 15 | 16 | // if the component has a render property, we are good 17 | if (Component.prototype.render) { 18 | return <Component session={session} loading={loading} {...props} /> 19 | } 20 | 21 | // if the passed component is a function component, there is no need for this wrapper 22 | throw new Error( 23 | [ 24 | "You passed a function component, `withSession` is not needed.", 25 | "You can `useSession` directly in your component.", 26 | ].join("\n") 27 | ) 28 | } 29 | 30 | // Usage 31 | class ClassComponent extends React.Component { 32 | render() { 33 | const { session, loading } = this.props 34 | return null 35 | } 36 | } 37 | 38 | const ClassComponentWithSession = withSession(ClassComponent) 39 | ``` 40 | 41 | ## Render Prop 42 | 43 | ```js 44 | import { useSession } from "next-auth/client" 45 | 46 | const UseSession = ({ children }) => { 47 | const [session, loading] = useSession() 48 | return children({ session, loading }) 49 | } 50 | 51 | // Usage 52 | class ClassComponent extends React.Component { 53 | render() { 54 | return ( 55 | <UseSession> 56 | {({ session, loading }) => ( 57 | <pre>{JSON.stringify(session, null, 2)}</pre> 58 | )} 59 | </UseSession> 60 | ) 61 | } 62 | } 63 | ``` 64 | -------------------------------------------------------------------------------- /versioned_docs/version-v3/warnings.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: warnings 3 | title: Warnings 4 | --- 5 | 6 | This is a list of warning output from NextAuth.js. 7 | 8 | All warnings indicate things which you should take a look at, but do not inhibit normal operation. 9 | 10 | --- 11 | 12 | ## Client 13 | 14 | #### NEXTAUTH_URL 15 | 16 | Environment variable `NEXTAUTH_URL` missing. Please set it in your `.env` file. 17 | 18 | --- 19 | 20 | ## Server 21 | 22 | These warnings are displayed on the terminal. 23 | 24 | #### JWT_AUTO_GENERATED_SIGNING_KEY 25 | 26 | To remedy this warning, you can either: 27 | 28 | **Option 1**: Pass a pre-regenerated Private Key (and, optionally a Public Key) in the jwt options. 29 | 30 | ```js title="/pages/api/auth/[...nextauth].js" 31 | jwt: { 32 | signingKey: process.env.JWT_SIGNING_PRIVATE_KEY, 33 | 34 | // You can also specify a public key for verification if using public/private key (but private only is fine) 35 | // verificationKey: process.env.JWT_SIGNING_PUBLIC_KEY, 36 | 37 | // If you want to use some key format other than HS512 you can specify custom options to use 38 | // when verifying (note: verificationOptions should include a value for maxTokenAge as well). 39 | // verificationOptions = { 40 | // maxTokenAge: `${maxAge}s`, // e.g. `${30 * 24 * 60 * 60}s` = 30 days 41 | // algorithms: ['HS512'] 42 | // }, 43 | } 44 | ``` 45 | 46 | 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`. 47 | 48 | **Option 2**: Specify custom encode/decode functions on the jwt object. This gives you complete control over signing / verification / etc. 49 | 50 | #### JWT_AUTO_GENERATED_ENCRYPTION_KEY 51 | 52 | #### SIGNIN_CALLBACK_REJECT_REDIRECT 53 | 54 | You returned something in the `signIn` callback, that is being deprecated. 55 | 56 | You probably had something similar in the callback: 57 | 58 | ```js 59 | return Promise.reject("/some/url") 60 | ``` 61 | 62 | or 63 | 64 | ```js 65 | throw "/some/url" 66 | ``` 67 | 68 | To remedy this, simply return the url instead: 69 | 70 | ```js 71 | return "/some/url" 72 | ``` 73 | 74 | #### STATE_OPTION_DEPRECATION 75 | 76 | 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: 77 | 78 | - If you use `state: true`, just simply remove it. The default is `protection: "state"` already.. 79 | - If you use `state: false`, set `protection: "none"`. 80 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | ["v3"] 2 | --------------------------------------------------------------------------------