Open guhyeon77 opened 1 year ago
I have spent hours trying to make it work, and it's not working 😆. but i think this solution will work https://medium.com/@badjessab/share-auth-session-between-nextjs-multi-zones-apps-using-nextauth-js-5bab51bb7e31
although i don't prefer it, it would be nice to have the api routes in auth.example.com and when i use
The solution worked but don't forget to enable cors
Environment
System: OS: Windows 10 10.0.19044 CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor Memory: 31.87 GB / 63.92 GB Binaries: Node: 19.9.0 - C:\Program Files\nodejs\node.EXE npm: 9.6.3 - C:\Program Files\nodejs\npm.CMD pnpm: 8.6.7 - C:\Program Files\nodejs\pnpm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.183)
Internet Explorer: 11.0.19041.1566
Reproduction URL
https://next-auth-example-ssg.vercel.app
Describe the issue
I was testing if it works with Nextjs' SSG method with the idea of floating nextAuth as a separate instance and domain. For example, nextAuth's api server is 'id.mydomain.com' and web site as 'www.mydomain.com' .
So I followed guide [https://next-auth.js.org/getting-started/client#custom-base-path]
To do what's in the guide
.env.local
After doing this,
_app.tsx
I modified it to and use code.
When using a function such as signIn in It does not go to NEXTAUTH_URL.
How to reproduce
clone https://github.com/guhyeon77/next-auth-example-ssg pnpm install
pnpm dev
then local is ssg https://next-auth-example-ssg.vercel.app is server.
Expected behavior
when pressing [sign in] button it going to https://next-auth-example-ssg.vercel.app/api/auth/signin