#NextAuth Shared between Microfrontends

1 messages · Page 1 of 1 (latest)

fickle sluice
#

Is there a way to share nextauth session data between 2 nextjs apps (localhost:3000 and localhost:4000) backend without using jwt secret?

jade fernBOT
#

Hi @fickle sluice. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, sharing NextAuth session data between two Next.js apps on different ports (localhost:3000 and localhost:4000) without using JWT secret is not directly addressed. However, there are some related points that might be helpful.

In one of the Github issues (https://github.com/vercel/next.js/issues/49002), a user describes a similar situation where they are trying to share user session data across different subdomains of their application. They mention that they've wrapped their whole app with a Providers component but still couldn't share the session data.

Another Github issue (https://github.com/vercel/next.js/issues/50160) suggests that server-side authentication issues might be better addressed in the NextAuth.js repository, and points to the getServerSession configuration in NextAuth.js for server-side authentication.

In a Vercel guide (https://vercel.com/guides/nextjs-multi-tenant-application), it's mentioned that if you're using Google as an OAuth provider, you might run into an issue where Google does not allow you to add localhost subdomains as an Authorized redirect URI. The suggested workaround is to use a different localhost port.

While these points might not directly answer your question, they suggest that sharing session data across different parts of a Next.js application can be complex and might require specific configuration or workarounds. It would be best to refer to the NextAuth.js documentation or community for more specific guidance on this issue.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: