Hi, We're authenticating our react app with super...
# general
t
Hi, We're authenticating our react app with supertokens react components successfully from SUBDOMAIN.DOMAIN.COM where our frontend lives and where the cookie is also set. Our main API and supertokens fastify middleware live on DOMAIN.COM/API and correctly set cookie and validate the requests The problem we have is that we have another authentication flow where customers will get a new supertokens cookie from DOMAIN.COM, they are supposed to be authenticated but the react auth component does not recognize it. Would you have a cue on how we could solve that?
r
hey @teebot
So you essentially want to share the session across SUBDOMAIN.DOMAIN.COM and DOMAIN.COM (both frontend) right?
t
DOMAIN.COM is API only
for additional context we need to authenticate users from a react native app to a webview
so what we made is a redirect that takes the JWT as input , creates a new session and sets the cookie in the redirect
r
So i don't think i am understanding the problem clearly
t
the webview has the react web auth supertokens component
r
right, and that web view's URL is?
t
SUDOMAIN.DOMAIN.COM
after being redirected that is
r
i see. So the session is not being created for SUDOMAIN.DOMAIN.COM? Which API is it querying?
t
the API and supertokens fastify middleware live on DOMAIN.COM
both for the react native app and for the webview loading the react webapp
r
So the session between SUDOMAIN.DOMAIN.COM and DOMAIN.COM is not working?
t
apparently indeed
r
right
t
we tried settings cookieDomain to a wildcard like .DOMAIN.COM but that created issues with some users not being able to refresh their token (Android)
r
hmm
t
if you want I can quickly show you a little demo
r
yea please do
t
with a screencast
ok I'll DM it to you in a minute
You can join the call and we can debug there
easier
Hey @teebot did the issue get resolved?
t
hey, thx for asking but not yet, it seems the cookie is still not picked up somehow. will dig further
we see the set-cookie from the response to the client side call to API but it's still not being interpreted as logged in
r
Hmmm. Can you enable debug logs on the frontend and backend and show me the output when this api call is made? And also a screenshot of the set-cookie header as seen on chrome
14 Views