coda-auth
v1.2.4
Published
Static Authentication for Next.js
Downloads
5
Maintainers
Readme
Next.js + Authentication
WARNING
This does not use dynamic values. This is currently for personal use and has values hardcoded for my setup. You probably should be using npm next-auth instead. Please do use this in anykind of production environment. That being said you can follow through my edits if you want to fork a version for yourself.
Purpose
Fork of npm next-auth which used a runtime environment variable of NEXTAUTH_URL to determine base url of authentication. When using the serverless-next.js Severless Framework Component it will be deployed at Lambda@Edge. This does not allow the use of adding environment variables and thus conflicts with the way next-auth handles routing. This package instead searches the lambda name for occurances of -prod- or -dev- and will pick a static base url from that. Where does it get the static base url? It is hardcoded right now. So, you probably should avoid this package unless you too want to fork and hardcode.
List of Edits
- created /dist/config.js
- specified a personally used url to become the export when lambda@edge -prod- or -dev- is found in the lambda name
- import this config into /dist/client/index.js a. any mentions of process.env.NEXTAUTH_URL will now also search for a url from this config
- import this config into /dist/server/index.js a. any mentions of process.env.NEXTAUTH_URL will now also search for a url from this config
Future
This package needs extensive testing and should be made more dynamic. Setting the baseUrl in the options of [...nextauth].js should be possible.