Skip to content
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

credentials: 'include' in the getSession call so that it can be used on domain and any subdomain. #2718

Closed
itzmukeshy7 opened this issue Sep 10, 2021 · 5 comments
Labels
enhancement New feature or request stale Did not receive any activity for 60 days

Comments

@itzmukeshy7
Copy link

Description 📓

I am using NextAuth for multiple subdomain and main domain, all auth working fine except that not able to get session on any other subdomain except the one I am using to set Cookie.

On other subdomains it's not sending the cookies with the request.

Other API endpoints are working fine after adding withCredentials: true for axios.

But not sure if we have any option to do so in NextAuth.

How to reproduce ☕️

Same as description.

Contributing 🙌🏽

Yes, I am willing to help implement this feature in a PR

@itzmukeshy7 itzmukeshy7 added the enhancement New feature or request label Sep 10, 2021
@balazsorban44
Copy link
Member

@itzmukeshy7
Copy link
Author

@balazsorban44 using this option and I can access the cookies on other sub domains but the getSession request is not including the cookies for other sub domain which are not part of auth flow.

image

@balazsorban44 balazsorban44 reopened this Sep 10, 2021
@balazsorban44
Copy link
Member

getSession is basically a fetch call right now.

Could you see if you recreate it of your own, you can control it better?

https://github.com/nextauthjs/next-auth/blob/main/src/client/index.js#L161-L167

Generally I want us stop using that method server-side, since fetch calls to API routes is not really recommended. See #1535.

I intend to do the necessary rewrite when v4 lands in stable.

@stale
Copy link

stale bot commented Nov 9, 2021

Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep it open. (Read more at #912) Thanks!

@stale stale bot added the stale Did not receive any activity for 60 days label Nov 9, 2021
@stale
Copy link

stale bot commented Nov 17, 2021

Hi there! It looks like this issue hasn't had any activity for a while. To keep things tidy, I am going to close this issue for now. If you think your issue is still relevant, just leave a comment and I will reopen it. (Read more at #912) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Did not receive any activity for 60 days
Projects
None yet
Development

No branches or pull requests

2 participants