How to use nextauth in statically exported html (Nextjs) deployed on different domain #5165
Unanswered
shaluvipin
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, i am trying to use statically generated nextjs HTML front end on different setup (let's say abc.com) while backend (apis) are on another domain ( let's say xyz.com) .. even after handling CORS problems and adding NEXTAUTH_URL=xyz.com , front end is generating api end points like abc.com/api/auth/ instead of xyz.com/api/auth/ (ie front end is not picking config variable NEXTAUTH_URL)
Found
apiBaseUrl function inside src/client/_utils is returning only relative path for client side -
export function apiBaseUrl(__NEXTAUTH: NextAuthClientConfig) {
if (typeof window === "undefined") {
// Return absolute path when called server side
return
${__NEXTAUTH.baseUrlServer}${__NEXTAUTH.basePathServer}
}
// Return relative path when called client side
return __NEXTAUTH.basePath
}
Please guide me .. how should i proceed to use nextauth in a project with static html front end on one domain and apis on another domain
Beta Was this translation helpful? Give feedback.
All reactions