Compare commits

...

13 Commits

Author SHA1 Message Date
Justin Forlenza
ad6c13cdc9 fix(ts): extend server type in Email provider from nodemailer (#2259)
* Added optional secure & TLS settings for SMTP

* Replaced custom interface with nodemailers

* Fix lockfile version

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2021-06-27 18:51:34 +02:00
Nico Domino
591aa7cc7e docs(adapter): rm @canary from adapters' install instructions (#2260) 2021-06-27 18:28:58 +02:00
ndom91
9abb392b4e chore: fix gh action typo 2021-06-27 03:39:38 +02:00
ndom91
b89ae87fb1 docs: respect color mode 2021-06-27 03:38:04 +02:00
ndom91
3687d17724 Merge branch 'main' of ssh://github.com/nextauthjs/next-auth 2021-06-27 03:11:07 +02:00
Balázs Orbán
b04ff82fb9 chore: clarify where to run envinfo in bug report template 2021-06-24 01:46:02 +02:00
Balázs Orbán
c11915ba9c chore: update bug report template 2021-06-24 01:44:33 +02:00
Balázs Orbán
24ee459f97 chore(ci): run tests and typechecks only 2021-06-24 00:38:17 +02:00
Balázs Orbán
ac4851d238 chore(ci): run test:ci (linting+test+typecheck) 2021-06-24 00:33:32 +02:00
can-mihci
84094b0ee7 docs(client): fix code block typo (#2217) 2021-06-22 20:11:18 +02:00
Vikrant Bhat
f09ab4a04f docs(providers): fix typo (#2220) 2021-06-22 20:08:43 +02:00
Vikrant Bhat
067364381b docs(providers): fix english sentence in Email provider section (#2222) 2021-06-22 09:28:47 +02:00
ndom91
6ee36b6842 ci: test release environment approval 2021-06-18 20:03:07 +02:00
15 changed files with 54 additions and 1774 deletions

View File

@@ -28,10 +28,10 @@ See [Kap](https://getkap.co/) for a good, easy-to-use, cross-platform screen rec
## Environment 🖥
Please run this command:
Please run this command in your project's root folder:
```
$ npx envinfo --system --binaries --browsers --npmPackages "{next-auth}"
```sh
npx envinfo --system --binaries --browsers --npmPackages "next,next-auth,react"
```
and paste the output here.

View File

@@ -21,7 +21,7 @@ jobs:
- name: Dependencies
uses: bahmutov/npm-install@v1
- name: Run tests
run: npm test -- --coverage --verbose
run: npm test -- --coverage --verbose && npm run test:types
- name: Coverage
uses: codecov/codecov-action@v1
with:
@@ -31,6 +31,7 @@ jobs:
run: npm run build
release:
name: Release
environment: release
needs: test
runs-on: ubuntu-latest
steps:

1755
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -100,6 +100,7 @@
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^13.1.9",
"@types/nodemailer": "^6.4.2",
"@types/react": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",

14
types/providers.d.ts vendored
View File

@@ -1,5 +1,6 @@
import { Profile, TokenSet, User } from "."
import { Awaitable, NextApiRequest } from "./internals/utils"
import { Options as SMTPConnectionOptions } from 'nodemailer/lib/smtp-connection'
export type ProviderType = "oauth" | "email" | "credentials"
@@ -127,17 +128,6 @@ export type CredentialsProvider = (
export type CredentialsProviderType = "Credentials"
/** Email Provider */
export interface EmailConfigServerOptions {
host: string
port: number
auth: {
user: string
pass: string
}
}
export type SendVerificationRequest = (params: {
identifier: string
url: string
@@ -149,7 +139,7 @@ export type SendVerificationRequest = (params: {
export interface EmailConfig extends CommonProviderOptions {
type: "email"
// TODO: Make use of https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
server: string | EmailConfigServerOptions
server: string | SMTPConnectionOptions
/** @default "NextAuth <no-reply@example.com>" */
from?: string
/**

View File

@@ -13,10 +13,10 @@ You can find the full schema in the table structure section below.
## Getting Started
1. Install `next-auth` and `@next-auth/dynamodb-adapter@canary`
1. Install `next-auth` and `@next-auth/dynamodb-adapter`
```js
npm install next-auth @next-auth/dynamodb-adapter@canary
npm install next-auth @next-auth/dynamodb-adapter
```
2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object.

View File

@@ -11,10 +11,10 @@ You can find the Fauna schema and seed information in the docs at [next-auth.js.
## Getting Started
1. Install `next-auth` and `@next-auth/fauna-adapter@canary`
1. Install `next-auth` and `@next-auth/fauna-adapter`
```js
npm install next-auth @next-auth/fauna-adapter@canary
npm install next-auth @next-auth/fauna-adapter
```
2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.

View File

@@ -9,10 +9,10 @@ This is the Firebase Adapter for [`next-auth`](https://next-auth.js.org). This p
## Getting Started
1. Install `next-auth` and `@next-auth/firebase-adapter@canary`
1. Install `next-auth` and `@next-auth/firebase-adapter`
```js
npm install next-auth @next-auth/firebase-adapter@canary
npm install next-auth @next-auth/firebase-adapter
```
2. Add this adapter to your `pages/api/[...nextauth].js` next-auth configuration object.

View File

@@ -13,10 +13,10 @@ Depending on your architecture you can use PouchDB's http adapter to reach any d
> **Prerequesite**: Your PouchDB instance MUST provide the `pouchdb-find` plugin since it is used internally by the adapter to build and manage indexes
1. Install `next-auth` and `@next-auth/pouchdb-adapter@canary`
1. Install `next-auth` and `@next-auth/pouchdb-adapter`
```js
npm install next-auth @next-auth/pouchdb-adapter@canary
npm install next-auth @next-auth/pouchdb-adapter
```
2. Add this adapter to your `pages/api/auth/[...nextauth].js` next-auth configuration object
@@ -28,10 +28,9 @@ import { PouchDBAdapter } from "@next-auth/pouchdb-adapter"
import PouchDB from "pouchdb"
// Setup your PouchDB instance and database
PouchDB
.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter
.plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin
PouchDB.plugin(require("pouchdb-adapter-leveldb")) // Any other adapter
.plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin
const pouchdb = new PouchDB("auth_db", { adapter: "leveldb" })
// For more information on each option (and a full list of options) go to
@@ -49,7 +48,7 @@ export default NextAuth({
})
```
## Advanced
## Advanced
### Memory-First Caching Strategy
@@ -60,4 +59,3 @@ Use an in-memory PouchDB as your main authentication database, and synchronize i
This will most likely not increase performance much in a serverless environment due to various reasons such as concurrency, function startup time increases, etc.
For more details, please see https://pouchdb.com/api.html#sync

View File

@@ -11,10 +11,10 @@ You can also use NextAuth.js with the new experimental Adapter for [Prisma](http
You may have noticed there is a `prisma` and `prisma-legacy` adapter. This is due to historical reasons, but the code has mostly converged so that there is no longer much difference between the two. The legacy adapter, however, does have the ability to rename tables which the newer version does not.
:::
To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate `@next-auth/prisma-adapter@canary` package:
To use this Adapter, you need to install Prisma Client, Prisma CLI, and the separate `@next-auth/prisma-adapter` package:
```
npm install @prisma/client @next-auth/prisma-adapter@canary
npm install @prisma/client @next-auth/prisma-adapter
npm install prisma --save-dev
```

View File

@@ -357,7 +357,7 @@ export default function App ({ Component, pageProps }) {
return (
<Provider session={pageProps.session}
options={{
clientMaxAge: 60 // Re-fetch session if cache is older than 60 seconds
clientMaxAge: 60, // Re-fetch session if cache is older than 60 seconds
keepAlive: 5 * 60 // Send keepAlive message every 5 minutes
}}
>

View File

@@ -13,7 +13,7 @@ The Email provider can be used in conjunction with (or instead of) one or more O
### How it works
On initial sign in, a **Verification Token** is sent to the email address provided. By default this token is valid for 24 hours. If the Verification Token is used with that time (i.e. by clicking on the link in the email) an account is created for the user and they are signed in.
On initial sign in, a **Verification Token** is sent to the email address provided. By default this token is valid for 24 hours. If the Verification Token is used within that time (i.e. by clicking on the link in the email) an account is created for the user and they are signed in.
If someone provides the email address of an _existing account_ when signing in, an email is sent and they are signed into the account associated with that email address when they follow the link in the email.

View File

@@ -34,7 +34,7 @@ providers: [
```
:::warning
Google only provide the Refresh Token to an application the first time a user signs in.
Google only provides Refresh Token to an application the first time a user signs in.
To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again:
https://myaccount.google.com/permissions

View File

@@ -48,7 +48,7 @@ export default {
```
:::note
[View source for built-in TypeORM models and schemas](https://github.com/nextauthjs/adapters/tree/canary/packages/typeorm-legacy/src/models)
[View source for built-in TypeORM models and schemas](https://github.com/nextauthjs/adapters/tree/main/packages/typeorm-legacy/src/models)
:::
## Using custom models

View File

@@ -42,12 +42,12 @@ module.exports = {
position: "left",
},
{
href: "https://www.npmjs.com/package/next-auth",
to: "https://www.npmjs.com/package/next-auth",
label: "npm",
position: "right",
},
{
href: "https://github.com/nextauthjs/next-auth",
to: "https://github.com/nextauthjs/next-auth",
label: "GitHub",
position: "right",
},
@@ -118,6 +118,13 @@ module.exports = {
],
copyright: "NextAuth.js &copy; Iain Collins 2021",
},
colorMode: {
respectPrefersColorScheme: true,
switchConfig: {
darkIcon: "🌑",
lightIcon: "💡",
},
},
},
presets: [
[