Skip to content

Conversation

@balazsorban44
Copy link
Member

Since v4, we have made providing a secret mandatory in production. The NextAuth configuration (in [...nextauth].js) required either the top-level secret or jwt.secret values to be set, otherwise an error is thrown. https://next-auth.js.org/errors#no_secret

To make this configuration easier (which ties in with #3657), we are going to detect if you set a NEXTAUTH_SECRET variable automatically, so it is less likely that you end up with the above error.

Reasoning 💡

Checklist 🧢

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

@github-actions github-actions bot added the core Refers to `@auth/core` label Feb 2, 2022
@balazsorban44 balazsorban44 temporarily deployed to Preview February 2, 2022 00:56 Inactive
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

🎉 Experimental release published on npm!

@balazsorban44 balazsorban44 merged commit f20d679 into main Feb 2, 2022
@balazsorban44 balazsorban44 deleted the feat/nextauth-secret branch February 2, 2022 01:08
balazsorban44 pushed a commit that referenced this pull request Apr 5, 2022
* docs: Update JWT docs to reflect JWE changes in v4

This PR #3039 changed the defaults for JWT tokens to be encrypted by default (JWE). We have conflicting documentation across the docs site and readme.

Additionatlly this PR #3783 made providing a secret required in production via NEXTAUTH_SECRET or an option.

* Missed a reference

* Update docs/docs/faq.md

Co-authored-by: Nico Domino <[email protected]>

* Update docs/docs/faq.md

Co-authored-by: Nico Domino <[email protected]>

Co-authored-by: Nico Domino <[email protected]>
mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
* feat(core): detect `NEXTAUTH_SECRET` env variable

* chore(dev): use detected `NEXTAUTH_SECRET` in dev app
mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
* docs: Update JWT docs to reflect JWE changes in v4

This PR nextauthjs#3039 changed the defaults for JWT tokens to be encrypted by default (JWE). We have conflicting documentation across the docs site and readme.

Additionatlly this PR nextauthjs#3783 made providing a secret required in production via NEXTAUTH_SECRET or an option.

* Missed a reference

* Update docs/docs/faq.md

Co-authored-by: Nico Domino <[email protected]>

* Update docs/docs/faq.md

Co-authored-by: Nico Domino <[email protected]>

Co-authored-by: Nico Domino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Refers to `@auth/core`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants