cms
cms copied to clipboard
migrated to Auth.js v5 from nextAuth and Edge runtime compatibility fixes
Title
"Migrated to Auth.js v5 from NextAuth and Edge Runtime Compatibility Fixes"
Problem Description
- Outdated NextAuth.js Version
- The project was using an old version of
next-auth, incompatible with the new designs folder structure. This caused issues with authentication flows and required updates to middleware and session management.
- The project was using an old version of
- Bcrypt Incompatibility with Edge Runtime
bcryptwas incompatible with the Edge runtime, leading to errors due to its reliance on native Node.js modules. More details can be found in this [GitHub issue](https://github.com/kelektiv/node.bcrypt.js/issues/1017).
- ORM compt
- Traditional ORMs had issues running in the Edge runtime
Solution
- Migration to Auth.js v5
- Upgraded to
authjsv5. - Refactored folder structure to align with the new design.
- Implemented necessary middleware and updated session management to use the new universal methods.
- Upgraded to
- Replacing Bcrypt
- Switched from
bcryptto an Edge-compatible alternative likebcryptjs. - And added nw login form.
- Switched from
- edgee-Compatible
- splited authentication config into separate files. this change ensures that we use a session strategy that’s compatible with the edge environment,
@ankitmukhia the PR is adding 11k+ lines and deleting many lines of code. I am also getting a similar issue in which I only changed one file, but when opening a PR it shows that I changed 10 files and added many lines. However, the other code is from someone else. How can I fix this? Do you have any ideas?