https://supertokens.com/ logo
Title
a

abhisheksinghkapoor

11/02/2022, 11:15 AM
How exactly does the doesSessionExist work?
r

rp

11/02/2022, 11:16 AM
hey @abhisheksinghkapoor
it reads tokens from the frontend to see if a session exists or not
a

abhisheksinghkapoor

11/02/2022, 11:16 AM
I am trying to hit an api with, it contains the cookies but when I check for the doesSessionExist it returns as false
r

rp

11/02/2022, 11:16 AM
doesSessionExist is a frontend function
are you calling it on the backend?
a

abhisheksinghkapoor

11/02/2022, 11:17 AM
No I am calling it on the frontend
r

rp

11/02/2022, 11:17 AM
what is the state of the frontend cookie store? Can you send a screenshot?
not response cookies
but cookies stored on the frontend
application > cookies
a

abhisheksinghkapoor

11/02/2022, 11:18 AM
Wait
r

rp

11/02/2022, 11:19 AM
have you called supertokens.init on the frontend?
before making the API call
a

abhisheksinghkapoor

11/02/2022, 11:19 AM
Yes I did
I am using it as a plugin
r

rp

11/02/2022, 11:20 AM
can you enable frontend debug logs and show me the output of the API call?
see the troubleshooting section in the docs
a

abhisheksinghkapoor

11/02/2022, 11:34 AM
ok
Not sure if I am able to find it
r

rp

11/02/2022, 11:46 AM
which recipe are you using?
a

abhisheksinghkapoor

11/02/2022, 11:46 AM
got it
r

rp

11/02/2022, 11:46 AM
ok
a

abhisheksinghkapoor

11/02/2022, 11:57 AM
The session logs aren't being consoled
r

rp

11/02/2022, 12:00 PM
right. This means you have not called supertokens.init of the fronternd SDK
can you do a console log right before the supertokens.init on the frontend and see if that gets printed out before the API call is made?
a

abhisheksinghkapoor

11/02/2022, 12:05 PM
SuperTokensRequest.init({ refreshTokenUrl:
${baseURL}/session/refresh
, sessionExpiredStatusCode: 440, enableDebugLogs: true, });
r

rp

11/02/2022, 12:06 PM
which version of the SDK are you using?
This is very old it seems
a

abhisheksinghkapoor

11/02/2022, 12:06 PM
4.4.1
r

rp

11/02/2022, 12:06 PM
and which SDK?
a

abhisheksinghkapoor

11/02/2022, 12:06 PM
supertokens-website
r

rp

11/02/2022, 12:07 PM
did u add axios interceptor when making the API call?
a

abhisheksinghkapoor

11/02/2022, 12:08 PM
I am not sure about usecase of axios interceptor
r

rp

11/02/2022, 12:08 PM
are you using axios?
a

abhisheksinghkapoor

11/02/2022, 12:09 PM
yes
SuperTokensRequest.makeSuper($axios);
r

rp

11/02/2022, 12:09 PM
yea thats what i meant
make sure that that is added before making the API call
a

abhisheksinghkapoor

11/02/2022, 12:10 PM
yea so basically this is all being used as a plugin itself
so they are being called when the page loads
r

rp

11/02/2022, 12:11 PM
hmm
a

abhisheksinghkapoor

11/02/2022, 12:11 PM
Making a check if it is failing by any chance
r

rp

11/02/2022, 12:11 PM
are you sure that the API being called is = to the value of
baseURL
that's set in the init function call?
cause i think the issue earlier as well was that there was some mismatch with this that was causing an issue
a

abhisheksinghkapoor

11/02/2022, 12:11 PM
means the endpoint of api and the baseUrl api
r

rp

11/02/2022, 12:11 PM
yes
a

abhisheksinghkapoor

11/02/2022, 12:12 PM
Ok I will debug for that