Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from nextauthjs:main #264

Merged
merged 174 commits into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
a113ef6
feat: encourage returning strings instead of throwing
balazsorban44 Feb 15, 2021
111e7aa
feat(provider): remove state property
balazsorban44 Feb 15, 2021
e418cdd
chore: merge main into next
balazsorban44 Feb 15, 2021
c20b7f2
feat: use IE11 as client code bundle target (#1402)
balazsorban44 Mar 1, 2021
930f58e
chore: merge main into next
balazsorban44 Mar 8, 2021
d09a45e
chore: merge main into next
balazsorban44 Mar 26, 2021
5f717b3
chore: merge main into next
balazsorban44 Apr 11, 2021
cb4342f
feat(build): modernize how we bundle next-auth (#1682)
balazsorban44 Apr 15, 2021
9fa93e3
fix(build): use optional-require dependency (#1736)
balazsorban44 Apr 15, 2021
a6f5f4c
fix: use upgraded require optional (#1743)
balazsorban44 Apr 16, 2021
2acabe1
Merge main into next
balazsorban44 Apr 23, 2021
edcb10a
Merge branch 'main' into next
balazsorban44 Apr 23, 2021
b6a3a72
Merge branch 'main' into next
balazsorban44 Apr 24, 2021
a388b44
Merge branch 'main' into next
balazsorban44 May 3, 2021
d29e3e9
Merge branch 'main'
balazsorban44 Jun 9, 2021
960bc1e
feat(adapter): remove adapters from core (#1919)
balazsorban44 Jun 9, 2021
ea9b6e3
fix(provider): convert github profile id from int to string (#2108)
tom-richter Jun 9, 2021
0c17af9
Merge branch 'main' into next
balazsorban44 Jun 10, 2021
5ac1db7
feat(provider): refactor Azure AD, B2C providers (#1591)
BenjaminWFox Jun 10, 2021
ed34534
fix(ts): add AzureAD to `OAuthProviderType`
balazsorban44 Jun 10, 2021
ca0ed1e
feat(react): create client tailored to React (#1473)
balazsorban44 Jun 11, 2021
abaa5ae
fix(react): don't use localStorage on server side (#2166)
balazsorban44 Jun 11, 2021
c07fe1b
docs: add versioned docs for unreleased v4.0.0-next.* (#2167)
ndom91 Jun 12, 2021
47c17a8
Merge branch 'main' into next
balazsorban44 Jun 12, 2021
dd12181
initialize session without loading state (#2180)
hboylan Jun 14, 2021
86ff89e
fix(react): initialize session without loading state (#2180)
balazsorban44 Jun 14, 2021
c1c866f
docs(provider): English language sentence fix (#2175)
bhatvikrant Jun 14, 2021
d10bd9b
fix(react): publish react scripts with npm build (#2192)
hboylan Jun 15, 2021
bbc2d9b
docs(provider): scope expects space separated string (#2188)
Cryt1c Jun 16, 2021
3383857
Merge branch 'main' into next
balazsorban44 Jun 16, 2021
fa89431
docs(provider): import `useState` in WorkOS example (#2198)
sheldonvaughn Jun 16, 2021
fb50b54
test(client-provider): fix flaky test (#2216)
ubbe-xyz Jun 20, 2021
3a48b8e
docs: update errors page with more details (#2196)
ndom91 Jun 22, 2021
a225324
Merge main into next
balazsorban44 Jun 25, 2021
988c991
test(ts): fix ts tests
balazsorban44 Jun 25, 2021
6c1a0ec
feat: bump dependencies (#2254)
balazsorban44 Jun 26, 2021
2833b66
feat(core): use named params in `callbacks` (#2173)
balazsorban44 Jun 26, 2021
2c35aa2
Merge main into next
balazsorban44 Jun 29, 2021
8ff4b26
Merge main into next
balazsorban44 Jul 2, 2021
53e5e37
docs: update tutorials/faq structure (#2256)
ndom91 Jul 5, 2021
a2e5afa
feat(react): make session requireable in `useSession` (#2236)
balazsorban44 Jul 5, 2021
cff153b
Merge main into next
balazsorban44 Jul 10, 2021
6911dd9
feat: rename `protection` to `checks` (#2255)
balazsorban44 Jul 10, 2021
acc9393
feat(logger): simplify `logger` API (#2344)
balazsorban44 Jul 11, 2021
111d5fc
feat(events): use named params for all event callbacks (#2342)
balazsorban44 Jul 11, 2021
ebf420c
docs: clarify page protection (#2355)
ndom91 Jul 11, 2021
3312e53
feat(events): include `profile` on `signIn` events (#2356)
t3dotgg Jul 13, 2021
6d74da1
refactor(providers): try Typescript
ubbe-xyz Jul 17, 2021
bececbc
Revert "refactor(providers): try Typescript"
ubbe-xyz Jul 17, 2021
f06e4d2
refactor: replace node-oauth with openid-client (#1698)
balazsorban44 Jul 20, 2021
7c65bda
feat: improve OAuth provider configuration (#2411)
balazsorban44 Aug 4, 2021
e5fe470
Merge main into next
balazsorban44 Aug 4, 2021
b50a2eb
refactor: remove wrapping Promise (#2514)
balazsorban44 Aug 11, 2021
92b9d22
fix(ts): fix internal react type import (#2450)
Aug 12, 2021
65040dc
fix(provider): make `userinfo.params` optional (#2517)
balazsorban44 Aug 13, 2021
55132e5
feat(provider): require to import every provider individually (#2518)
balazsorban44 Aug 13, 2021
8914f88
feat: simplify Adapter API (#2361)
balazsorban44 Aug 15, 2021
78d8f28
fix(ts): allow void return type on delete operations
balazsorban44 Aug 16, 2021
2c43fbd
fix(provider): remove double CSS from email template
balazsorban44 Aug 17, 2021
e06ced5
chore: add FaunaAdapter to dev app
balazsorban44 Aug 17, 2021
e15bf9b
feat(provider): use more restrictive default scope for GitHub (#2579)
nathanclevenger Aug 21, 2021
a9f699f
fix(callback): respect `callbackUrl` in Email Provider (#2574)
dan-kwiat Aug 23, 2021
eb8ba69
feat(provider): add Keycloak provider (#2485)
bbigras Aug 23, 2021
d76f15b
test(client): fully cover client module (#2295)
ubbe-xyz Aug 26, 2021
5da6288
docs: add v4 migration docs page (#2350)
ndom91 Aug 26, 2021
55ab95e
docs(providers): split provider type docs into individual pages (#2480)
ndom91 Aug 26, 2021
a49903f
Merge main into next
balazsorban44 Aug 26, 2021
1c1e841
chore(docs): remove docs from repo (#2609)
balazsorban44 Aug 27, 2021
08349c3
feat(client): remove `staleTime` (#2613)
ubbe-xyz Aug 27, 2021
e099223
refactor(ts): rewrite core to TypeScript (#2552)
balazsorban44 Aug 31, 2021
8f32b5d
refactor(dev): use Next.js `externalDir` to fix dev app (#2631)
balazsorban44 Sep 1, 2021
245567b
fix: avoid infinite loop in error handlers (#2647)
balazsorban44 Sep 2, 2021
da8d729
Merge main into next
balazsorban44 Sep 4, 2021
3f943d2
Merge beta into next
balazsorban44 Sep 4, 2021
7dfc581
chore: remove docs after merge
balazsorban44 Sep 4, 2021
8bfbaa4
chore: fix build due to Next.js type error
balazsorban44 Sep 5, 2021
2cb763c
chore: remove `test:types` script in release workflow
balazsorban44 Sep 5, 2021
419ffe7
fix(ts): make `options` on `useSession` optional
balazsorban44 Sep 6, 2021
3b23cfe
fix(ts): forward credentials fields to authorize (#2683)
balazsorban44 Sep 6, 2021
0989acc
fix(ts): make OAuth profile overrideable (#2682)
balazsorban44 Sep 6, 2021
17bea4a
fix(ts): hint built-in provider types in `signIn` (#2655)
Patryks1 Sep 7, 2021
819e97e
fix: respect `id` from user options in `signinUrl` and `callbackUrl` …
Sep 8, 2021
ea3f0d6
refactor(ts): move Twitch to TypeScript
balazsorban44 Sep 15, 2021
a2c4046
fix(ts): add defaults to `OAuthConfig` generics
balazsorban44 Sep 15, 2021
cabcdc9
feat: built-in page theme updates (#2788)
ndom91 Sep 19, 2021
04fc3fd
fix(provider): remove extra brace from `jwks_uri` (#2813)
Sep 22, 2021
a177bbb
fix: login logo height
ndom91 Sep 22, 2021
424bd04
fix(providers): refactor Azure AD provider to support v4 (#2818)
ndom91 Sep 22, 2021
19a33f3
chore(dev): add AzureADProvider to dev app
balazsorban44 Sep 22, 2021
9693277
chore(app): add SpotifyProvider to dev app
balazsorban44 Sep 22, 2021
1d52600
fix(provider): refactor LinkedIn provider (#2821)
balazsorban44 Sep 24, 2021
ffa2b1b
fix: use default export map syntax for ESM/CJS (#2830)
ndom91 Sep 25, 2021
5066726
feat(providers): refactor Cognito provider (#2829)
balazsorban44 Sep 25, 2021
b052d4c
fix(providers): make string endpoint handlers overrideable (#2842)
balazsorban44 Sep 26, 2021
c2fd58d
chore: remove unused `www` reference
balazsorban44 Sep 27, 2021
f0551b0
feat(providers): refactor Slack provider (#2848)
balazsorban44 Sep 28, 2021
9e1eab0
fix(providers): convert to TS, add `picture` (#2851)
balazsorban44 Sep 28, 2021
50e6a64
feat(providers): expose `openid-client` options `client` and `jwks` (…
balazsorban44 Sep 28, 2021
f635035
fix(provider): refactor Okta provider (#2856)
kiranjd Sep 28, 2021
72d4c5b
feat(providers): refactor Azure B2C provider (#2862)
balazsorban44 Sep 29, 2021
c5bd99d
feat(signin): Support passing any argument to credentials input (#2876)
zakaryan2004 Oct 1, 2021
0707ba6
fix(signin): Set default input type to text to fix CSS (#2881)
zakaryan2004 Oct 2, 2021
5149a5d
chore: trigger CI
balazsorban44 Oct 3, 2021
dfff2e6
fix: correctly set authorization url for OAuth1 (#2884)
balazsorban44 Oct 3, 2021
a0b9577
chore(deps): upgrade dependencies (#2900)
balazsorban44 Oct 5, 2021
19e326e
fix: conditionally render theme logo on builtin pages (#2916)
ndom91 Oct 8, 2021
129d161
fix(providers): Refactor Line Provider (#2917)
ThangHuuVu Oct 8, 2021
58a98b6
fix(providers): resize default AzureAD profile picture (#2910)
balazsorban44 Oct 10, 2021
eb33c9d
refactor: decouple Next.js from core (#2857)
balazsorban44 Oct 27, 2021
72408ab
feat: update `jose` and `openid-client` (#3039)
panva Oct 27, 2021
c8b7e2e
fix: uuid import (#3056)
hayedewit Oct 28, 2021
5725931
fix(providers): add default `id_token_signed_response_alg` to LINE (#…
ThangHuuVu Oct 29, 2021
c089ede
refactor: use universal modules in `next-auth/jwt` (#3062)
panva Oct 29, 2021
1d9b7b8
feat(react): preserve history on client-side navigation (#2980)
balazsorban44 Oct 29, 2021
da991de
fix: bump openid-client (#3063)
panva Oct 29, 2021
b66afcc
fix: normalize URL before parsing (#3077)
srijans38 Oct 31, 2021
4181988
fix(oauth): allow 10 sec clock tolerance (#3071)
balazsorban44 Oct 31, 2021
1597369
fix: correctly transpile all client-side submodules (#3100)
balazsorban44 Nov 3, 2021
533ed94
feat: Clerk to README supporters
ndom91 Nov 3, 2021
78fa333
docs(readme): opencollective domain (#3066)
nicovak Nov 4, 2021
f998bf2
refactor: strict types (#2802)
Thisen Nov 4, 2021
0d7d8da
fix: use `error` query param if set (#3141)
balazsorban44 Nov 7, 2021
6502b63
feat: allow relative redirects (#3140)
balazsorban44 Nov 7, 2021
ba39efb
feat: rename session strategy (#3144)
balazsorban44 Nov 7, 2021
e9ac11b
fix: respect `host` in `getServerSession` (#3179)
balazsorban44 Nov 11, 2021
043b252
refactor: decouple CSRF-state (#3142)
balazsorban44 Nov 11, 2021
b871b47
fix: allow configuring http timeout (#3188)
balazsorban44 Nov 12, 2021
38cefdd
fix(providers): set 42 default scope (#3189)
estarossa0 Nov 13, 2021
f9e0ef8
feat: introduce chunking when session cookie becomes too big (#3101)
balazsorban44 Nov 15, 2021
76bf524
feat: make missing secret an error (#3143)
balazsorban44 Nov 15, 2021
5e803cd
refactor(providers): convert 42 to TypeScript (#3211)
estarossa0 Nov 16, 2021
15d1fab
fix: correct assertion when Credentials only (#3217)
balazsorban44 Nov 16, 2021
432876c
fix(providers): refactor Zoom
dijs Nov 16, 2021
7beb3ff
refactor(providers): cleanup 42 (#3221)
balazsorban44 Nov 17, 2021
64b2a2c
fix: assert `action` when `req.query` isn't available (#3222)
balazsorban44 Nov 17, 2021
31426b9
fix(providers): match filename with 42 Provider's `id` (#3225)
balazsorban44 Nov 17, 2021
0f132de
feat(providers): add Pipedrive provider (#3011)
estevanjantsk Nov 17, 2021
35ee608
feat(providers): add Osu! provider (#3234)
t0rb3n Nov 20, 2021
4dc7674
fix(providers): Rewrite EVEOnline in TS, fix default scopes (#2759)
mckernanin Nov 26, 2021
187a147
feat(oauth): expose `httpOptions` (#3287)
balazsorban44 Nov 26, 2021
2570168
fix: add custom error message when session required (#3288)
balazsorban44 Nov 28, 2021
22f74d7
fix(providers): correct authorization url for Atlassian (#2999)
hckhanh Nov 28, 2021
c44b860
feat(providers): refactor Apple provider (#2875)
balazsorban44 Nov 28, 2021
b01f680
chore(providers): TS improvements (#3295)
balazsorban44 Nov 28, 2021
d1d0db4
feat(providers): ensure GitHub provider always gives an email (#3302)
nkalupahana Nov 29, 2021
8644e55
Merge branch 'main' into beta
balazsorban44 Nov 30, 2021
cc17ddf
fix: Fallback to --color-text when no color-brand (#3313)
JameelKhan9 Dec 1, 2021
50fe115
Release v4
balazsorban44 Dec 1, 2021
c0dddfb
docs: upgrade README
balazsorban44 Dec 1, 2021
fedb848
docs: add top contributors to package.json
balazsorban44 Dec 1, 2021
1f4b7d8
chore: add opencollective to package.json (#3333)
ndom91 Dec 2, 2021
4dcdb62
fix: remove `nextauth` from authorization params (#3332)
dnikomon Dec 2, 2021
8ea75f0
fix(ts): typo in `Auth0Profile` interface (#3347)
anthonyringoet Dec 4, 2021
5ac688c
fix(providers): convert 42 School profile `id` to string (#3351)
estarossa0 Dec 4, 2021
0431c2a
fix(ts): improve types for `encode`/`decode` functions (#3346)
DmitryScaletta Dec 4, 2021
2670bbb
docs: match docs page wording for `SECURITY.md`
balazsorban44 Dec 6, 2021
9eb78a9
chore: fix typo in comment (#3388)
paulbuechner Dec 8, 2021
59797bb
fix: use `VERCEL_URL` by default for `secureCookie` (#3399)
balazsorban44 Dec 8, 2021
1c7fe57
fix: default to `VERCEL_URL` for `callbackUrl`
balazsorban44 Dec 8, 2021
b0f6175
chore(deps): upgrade `next` dev dependency
balazsorban44 Dec 8, 2021
30a0fc6
fix: properly handle callback URL fallback (#3402)
balazsorban44 Dec 8, 2021
ac35d9f
docs: Fix README.md typo (#3412)
etienne-martin Dec 9, 2021
8b9a109
fix(providers): refactor FusionAuth to v4 (#3376)
alessandrojcm Dec 9, 2021
2c269a6
fix(providers): use `id_token` by default on Okta provider (#3418)
bogdansoare Dec 11, 2021
8ab057e
chore(deps): ugprade dependencies (#3415)
balazsorban44 Dec 11, 2021
978e2ee
chore(dev): minor fixes on dev app
balazsorban44 Dec 11, 2021
87d0beb
fix(jwt): use authorization header as fallback (#3453)
mewdriller Dec 16, 2021
48749d7
fix(pages): remove default placeholder for credentials provider (#3451)
KirankumarAmbati Dec 18, 2021
d1d2d97
fix(providers): use `idToken` by default in Cognito provider (#3448)
Donivanes Dec 18, 2021
0e8be0c
docs: fix OpenCollective link in `README.md` (#3494)
askkaz Dec 21, 2021
e2add6a
chore(dev): fix start email script (#3541)
ThangHuuVu Dec 30, 2021
c493699
chore(app): upgrade dev app dependencies
balazsorban44 Dec 30, 2021
a09a75b
fix(providers): make Strava work again (#3520)
krautwigundrueben Jan 1, 2022
c71cb84
fix(oauth): set `httpOptions` before issuer discovery (#3537)
yfridelance Jan 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/types/ @balazsorban44 @lluia
/__tests__/ @lluia
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ body:
attributes:
value: |
It takes a lot of work 🏋🏻‍♀️ maintaining a library like `next-auth`; any contribution is more than welcome 💚

10 changes: 0 additions & 10 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@ test:
- test/**/*
- types/tests/**/*

documentation:
- www/**/*
- ./**/*.md

providers:
- src/providers/**/*
- www/docs/configuration/providers.md
- test/integration/**/*

adapters:
- src/adapters/**/*
- www/docs/schemas/adapters.md

databases:
- www/docs/schemas/*.md
- test/docker/databases/**/*
- www/docs/configuration/databases.md
- test/fixtures/**/*

core:
Expand All @@ -29,11 +21,9 @@ style:

client:
- src/client/**/*
- www/docs/getting-started/client.md

pages:
- src/server/pages/**/*
- www/docs/configuration/pages.md

TypeScript:
- types/**/*
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Build
run: npm run build
- name: Run tests
run: npm test -- --coverage --verbose && npm run test:types
run: npm test -- --coverage --verbose
- name: Coverage
uses: codecov/codecov-action@v1
with:
Expand Down Expand Up @@ -66,11 +66,21 @@ jobs:
node-version: 16
- name: Dependencies
uses: bahmutov/npm-install@v1
- name: Determine version
uses: ./config/version-pr
id: determine-version
env:
PR_NUMBER: ${{ github.event.number }}
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm run version:pr
npm publish --access public --tag experimental
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Comment version on PR
uses: NejcZdovc/comment-pr@v1
with:
message: "🎉 Experimental release [published on npm](https://www.npmjs.com/package/next-auth/v/${{ env.VERSION }})!\n\n```sh\nnpm i next-auth@${{ env.VERSION }}\n```\n```sh\nyarn add next-auth@${{ env.VERSION }}\n```"
env:
VERSION: ${{ steps.determine-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 18 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,41 @@ node_modules
.next
/build
/dist
/www/build

# Generated files
.docusaurus
.cache-loader
www/providers.json
src/providers/index.js
/internals
/providers
/src/providers/oauth-types.ts
/client
/css
/lib
/core
/jwt
/react
/adapters.d.ts
/adapters.js
/client.d.ts
/client.js
/index.d.ts
/index.js
/jwt.d.ts
/jwt.js
/providers.d.ts
/providers.js
/errors.js
/errors.d.ts
/next

# Development app
app/next-auth
app/dist/css
app/src/css
app/package-lock.json
app/yarn.lock
app/prisma/migrations
app/prisma/dev.db*
app/dist
app/next-auth

# VS
/.vs/slnx.sqlite-journal
/.vs/slnx.sqlite
/.vs
.vscode

# Jetbrains
.idea

# GitHub Actions runner
/actions-runner
/_work
Expand All @@ -61,4 +63,4 @@ app/yarn.lock
/prisma/migrations

# Tests
/coverage
/coverage
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx pretty-quick --staged
# npx pretty-quick --staged
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Anyone can be a contributor. Either you found a typo, or you have an awesome fea

A quick guide on how to setup _next-auth_ locally to work on it and test out any changes:

The dev application requires you to use `npm@7`.
The developer application requires you to use `npm@7`.

1. Clone the repo:

Expand All @@ -34,7 +34,7 @@ git clone git@github.com:nextauthjs/next-auth.git
cd next-auth
```

2. Install packages, set up the dev application:
2. Install packages and set up the developer application:

```sh
npm run dev:setup
Expand All @@ -47,23 +47,23 @@ npm run dev:setup
> NOTE: You can add any environment variables to .env.local that you would like to use in your dev app.
> You can find the next-auth config under`app/pages/api/auth/[...nextauth].js`.

4. Start the dev application/server:
1. Start the developer application/server:

```sh
npm run dev
```

Your dev application will be available on `http://localhost:3000`
Your developer application will be available on `http://localhost:3000`

That's it! 🎉

If you need an example project to link to, you can use [next-auth-example](https://github.com/iaincollins/next-auth-example).

#### Hot reloading

When running `npm run dev`, you start a Next.js dev server on `http://localhost:3000`, which includes hot reloading out of the box. Make changes on any of the files in `src` and see the changes immediately.
When running `npm run dev`, you start a Next.js developer server on `http://localhost:3000`, which includes hot reloading out of the box. Make changes on any of the files in `src` and see the changes immediately.

> NOTE: When working on CSS, you will have to manually refresh the page after changes. The reason for this is our pages using CSS are server-side rendered. (Improving this through a PR is very welcome!)
> NOTE: When working on CSS, you will have to manually refresh the page after changes. The reason for this is our pages using CSS are server-side rendered (using API routes). (Improving this through a PR is very welcome!)

> NOTE: The setup is as follows: The development application lives inside the `app` folder, and whenever you make a change to the `src` folder in the root (where next-auth is), it gets copied into `app` every time (gitignored), so Next.js can pick them up and apply hot reloading. This is to avoid some annoying issues with how symlinks are working with different React builds, and also to provide a super-fast feedback loop while developing core features.

Expand Down
80 changes: 59 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ NextAuth.js is a complete open source authentication solution for [Next.js](http
It is designed from the ground up to support Next.js and Serverless.

This is the core repo for NextAuth.js. Check the repos below if you are interested in additional information:

- Docs related: https://github.com/nextauthjs/docs
- Adapter related: https://github.com/nextauthjs/adapters

## Getting Started

```
Expand Down Expand Up @@ -71,61 +72,64 @@ NextAuth.js can be used with or without a database.

### Secure by default

- Promotes the use of passwordless sign in mechanisms
- Designed to be secure by default and encourage best practice for safeguarding user data
- Uses Cross Site Request Forgery Tokens on POST routes (sign in, sign out)
- Promotes the use of passwordless sign-in mechanisms
- Designed to be secure by default and encourage best practices for safeguarding user data
- Uses Cross-Site Request Forgery (CSRF) Tokens on POST routes (sign in, sign out)
- Default cookie policy aims for the most restrictive policy appropriate for each cookie
- When JSON Web Tokens are enabled, they are signed by default (JWS) with HS512
- Use JWT encryption (JWE) by setting the option `encryption: true` (defaults to A256GCM)
- Auto-generates symmetric signing and encryption keys for developer convenience
- Features tab/window syncing and keepalive messages to support short lived sessions
- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org/)
- Features tab/window syncing and session polling to support short lived sessions
- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org)

Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.

### TypeScript

NextAuth.js comes with built-in types. For more information and usage, check out the [TypeScript section](https://next-auth.js.org/getting-started/typescript) in the documentation.

The package at `@types/next-auth` is now deprecated.
NextAuth.js comes with built-in types. For more information and usage, check out
the [TypeScript section](https://next-auth.js.org/getting-started/typescript) in the documentation.

## Example

### Add API Route

```javascript
// pages/api/auth/[...nextauth].js
import NextAuth from "next-auth"
import Providers from "next-auth/providers"
import AppleProvider from "next-auth/providers/apple"
import GoogleProvider from "next-auth/providers/google"
import EmailProvider from "next-auth/providers/email"

export default NextAuth({
secret: process.env.SECRET,
providers: [
// OAuth authentication providers
Providers.Apple({
AppleProvider({
clientId: process.env.APPLE_ID,
clientSecret: process.env.APPLE_SECRET,
}),
Providers.Google({
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
// Sign in with passwordless email link
Providers.Email({
EmailProvider({
server: process.env.MAIL_SERVER,
from: "<no-reply@example.com>",
}),
],
// SQL or MongoDB database (or leave empty)
database: process.env.DATABASE_URL,
})
```

### Add React Component
### Add React Hook

The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.

```javascript
import { useSession, signIn, signOut } from "next-auth/client"
import { useSession, signIn, signOut } from "next-auth/react"

export default function Component() {
const [session, loading] = useSession()
const { data: session } = useSession()
if (session) {
return (
<>
Expand All @@ -143,7 +147,26 @@ export default function Component() {
}
```

## Acknowledgements
### Share/configure session state

Use the `<SessionProvider>` to allow instances of `useSession()` to share the session object across components. It also takes care of keeping the session updated and synced between tabs/windows.

```jsx title="pages/_app.js"
import { SessionProvider } from "next-auth/react"

export default function App({
Component,
pageProps: { session, ...pageProps }
}) {
return (
<SessionProvider session={session}>
<Component {...pageProps} />
</SessionProvider>
)
}
```

## Acknowledgments

[NextAuth.js is made possible thanks to all of its contributors.](https://next-auth.js.org/contributors)

Expand All @@ -156,7 +179,7 @@ export default function Component() {

### Support

We're happy to announce we've recently created an [OpenCollective](https://opencollective.org/nextauth) for individuals and companies looking to contribute financially to the project!
We're happy to announce we've recently created an [OpenCollective](https://opencollective.com/nextauth) for individuals and companies looking to contribute financially to the project!

<!--sponsors start-->
<table>
Expand All @@ -176,13 +199,27 @@ We're happy to announce we've recently created an [OpenCollective](https://openc
<div>Prisma</div><br />
<sub>🥉 Bronze Financial Sponsor</sub>
</td>
<td align="center" valign="top">
<a href="https://clerk.dev" target="_blank">
<img width="128px" src="https://github.com/avatars/u/49538330?s=200&v=4" alt="Prisma Logo" />
</a><br />
<div>Clerk</div><br />
<sub>🥉 Bronze Financial Sponsor</sub>
</td>
<td align="center" valign="top">
<a href="https://checklyhq.com" target="_blank">
<img width="128px" src="https://github.com/avatars/u/25982255?v=4" alt="Checkly Logo" />
</a><br />
<div>Checkly</div><br />
<sub>☁️ Infrastructure Support</sub>
</td>
<td align="center" valign="top">
<a href="https://superblog.ai/" target="_blank">
<img width="128px" src="https://d33wubrfki0l68.cloudfront.net/cdc4a3833bd878933fcc131655878dbf226ac1c5/10cd6/images/logo_bolt_small.png" alt="superblog Logo" />
</a><br />
<div>superblog</div><br />
<sub>☁️ Infrastructure Support</sub>
</td>
</tr><tr></tr>
</tbody>
</table>
Expand All @@ -191,7 +228,8 @@ We're happy to announce we've recently created an [OpenCollective](https://openc

## Contributing

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).
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).

## License

Expand Down
16 changes: 8 additions & 8 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

NextAuth.js practices responsible disclosure.

## Supported Versions

Security updates are only released for the current version.

Old releases are not maintained and do not receive updates.

## Reporting a Vulnerability

We request that you contact us directly to report serious issues that might impact the security of sites using NextAuth.js.
Expand All @@ -19,6 +13,12 @@ If you contact us regarding a serious issue:
- We will disclose the issue (and credit you, with your consent) once a fix to resolve the issue has been released.
- If 90 days has elapsed and we still don't have a fix, we will disclose the issue publicly.

Currently, the best way to report an issue is by contacting us via email at me@iaincollins.com or info@balazsorban.com and yo@ndo.dev.
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.)

For less serious issues (e.g. RFC compliance for unsupported flows or potential issues that may cause a problem future or default behaviour / options) 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.
> 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.

## Supported Versions

Security updates are only released for the current version.

Old releases are not maintained and do not receive updates.
Loading