-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
baseUrl is not considered on client side code #900
Comments
I patched the library and noticed that it's not thought to work from a different domain. When the |
Hi there! When called client side, only making requests to the same domain are supported, so we ignore If you are running multiple apps on the same domain but on a different path, you can set (The basePath option is undocumented as it is now automatically extracted from If you are running multiple domains then I'm afraid that's not currently supported. |
I'm running several apps on the same domain, but on local dev each app run on a different port on localhost, which means different domains (even if the cookie works well). I'd need to add a reverse proxy as nginx or caddy on top of it on local, but it's not worth at the moment. My current solution is to do a request similar to your getSession but with credentials always included on local dev. This is not an option in next-auth and I understand why. Feel free to close this issue. |
I'm unable to replicate this behaviour. The app is served with a basepath. I set NEXTAUTH_URL and this seems to work well on the client-side. But when I use the I had to set the |
@iaincollins the problem with this is that on client-side, |
@androa Can you post a snippet of code to how you did this? I'm running into the exact same issue |
Nevermind, found it here: #499 (comment) Here's the code to save other's time:
|
// .env file: // next.config.js |
this has saved, so much of time. Thank you #1110 |
Your question
baseUrl Provider option (which is undocumented) is not considered on client side, for example when using
useSession()
. I noticed the code explicitely does this hereWhat are you trying to do
I have several application working on the same domain, on different subpath. Since the authentication is set on that domain, I'd like to use the client library to check signin status and so I'm trying to use the Provider on each project. In local development, done on localhost, I want to set the baseUrl to the value I prefer.
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: