-
Notifications
You must be signed in to change notification settings - Fork 86
feat: ✨ add out-of-the-box support for NextAuth.js #1309
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
Conversation
If the 'next-auth' package is detected, automatically set the NEXTAUTH_URL to the netlify site URL
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
✅ Deploy Preview for next-plugin-rsc-demo canceled.
|
✅ Deploy Preview for next-plugin-edge-middleware canceled.
|
export const isNextAuthInstalled = (): boolean => { | ||
try { | ||
// eslint-disable-next-line import/no-unassigned-import, node/no-extraneous-require, import/no-extraneous-dependencies | ||
require('next-auth') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach follows what's suggested in the npm documentation around optional dependencies
demos/nextAuth-demo/README.md
Outdated
Copy the .env.local.example file in this directory to .env.local (which will be ignored by Git): | ||
|
||
``` | ||
cp .env.local.example .env.local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[dust] We could improve the DX by running cp .env.local.example .env.local
as part of a postinstall action, checking if one exists already before overwriting it. This also relates to our discussion on Slack about setting up some env vars postinstall.
This looks great! Can we get the demo site setup to build for PRs? I'd say this is a boulder unless there's a good reason not to |
👷 Deploy Preview for bright-unicorn-4dffab processing.
|
mainly done to trigger a deploy preview build and that it works as expected
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
look to be needed by the build container
Addresses error caused by multiple versions of react installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes @ericapisani! Let's go! 🚀
Summary
Adds out of the box support for NextAuth.js by setting the
NEXTAUTH_URL
to the URL representing the main address of the Netlify site when thenext-auth
package is detected.A user will still be required to set the
NEXTAUTH_SECRET
in production in order to encrypt the NextAuth.js JWT and hash email verification tokens. Related docsTest plan
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Fixes #1242
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was published correctly.