https://supertokens.com/ logo
Title
u

ulys

10/27/2022, 11:49 AM
Hello, we are using the node express sdk. We have 2 frontends
a.domain.com
and
b.domain.com
that will both use the access cookies. In order for this to work we've set the session recipe init like :
Session.init({
  ...
  cookieDomain: '.domain.com',
  ...
But this now prevents cookies to be set when working locally. Is there any way for cookies to be set under either
.domain.com
or
localhost
for example?
r

rp

10/27/2022, 11:53 AM
hey @ulys are you sharing the same server for local dev and when it's being queried from
.domain.com
?
or is it just the same code, but different servers?
u

ulys

10/27/2022, 12:00 PM
Well I can't ask front-end collaborators to spin the backend locally so locally they're using the same server that is being queried by let's say
dev.a.domain.com
r

rp

10/27/2022, 12:07 PM
hmmm. Is it possible for you to deploy a backend server just for localhost and use this one for
.domain
? That would be easiest
If not, then you will have to hack around functions that set cookies to manually change this config based on the input domain, which is possible, but it's just not clean
u

ulys

10/27/2022, 12:43 PM
Yeah we'll try avoiding anything hacky. We ended up having local frontend projects use a
something.domain.com
virtual host and it seems to be doing the trick. Now I just have to find out how to do something similar with postman haha Thanks for your help @rp !
r

rp

10/27/2022, 12:55 PM
Happy to help 🙂