Is there an easy way to share a session on 2 localhost frontends on 2 different ports? e.g. localh...
c
Is there an easy way to share a session on 2 localhost frontends on 2 different ports? e.g. localhost:8080 and localhost: 9000
r
I think this should happen by default.
Are the backends for both different or the same?
c
The same
r
right. So i think this should work without you having to do anything
c
But in the api I am selecting a port
r
the websiteDomain value on the backend should be either one of the frontend domains - depending on which one you show the auth UI on
and the websiteDomain on the frontend should be as per what that frontend is loaded on (localhost:8080 or localhost:9000)
c
Ok let me try
On the front-ends I am not using
websiteDomain
, I am using with Vue
Should I ?
r
ah i see.
no that's fine
i thought you were using supetokens-auth-react SDK
c
I first create the session on localhost:8080 Then try to visit http://editor.localhost:9001/ and the session is not shared. Is it because of the subdomain?
r
ah yea. sub domain indeed
but im not sure if it's gonna work cause you are using localhost. But give it a try anyway
set the
sessionScope
to
.localhost
c
It works without the subdomain, but not with it
r
yeaaa. Cause you are using localhost on the frontend. I don't think putting a .localhost is a valid cookieDomain (browser may reject it)
so maybe use something other than localhost - like a proper domain and change your PC's hosts file to redirect it to localhost
c
How would I distinguish between the ports? I can only set 127.0.0.1, not a port. I am on windows
r
i don't think IP addresses would work either
you will have to give a proper domain name
c
Getting this error in the backend:
Error: Please make sure that the apiDomain and websiteDomain have correct values
r
Can you print out the value of websiteDomain and apiDomain?
c
Yes
r
What is the stack trace of the error?
c
What do you mean?
r
The full error not just the message part of it
c
It works only if I change it back to localhost
Do I need to do anything s[ecial to run a custom host with nodemon?
r
this is weird. Give me a min
right. So onrender.com is a special domain name - it's in the public suffix list: https://publicsuffix.org/
So the domain you have provided with onrender.com is actually inaccurate.
if you provide the correct domain values as given by onrender.com (when you sign up on their site), it should be fine
c
I see, thanks
Now getting connection refused. Is it because I am on http?
r
Connection refused is cause the server is not running or some firewall setting issue. Nothing to with supertokens setup
c
I tried to disable windows defender and its the same. The api is definetely running.
r
Can you use postman to query that api? What does it return?
c
r
This is a DNS lookup error. This is something you will have to fix yourself. Nothing to do with ST
3 Views