Session does not exist after successfull login in ...
# support-questions-legacy
s
I am developing at sveltekit/capacitor app... in android everything works ok with regrds to supertokens authentication... but in ios devices, I get a successfull sign-in with a success response from server, but then the once I try to authenticate using the
Session
I get:
No session exists
error. Any ideas?

https://cdn.discordapp.com/attachments/1096348599132115065/1096348602831491133/IMG_1479.PNG

r
@nkshah2 can help here.
n
Hi @sdekna , Capacitor on iOS does not use the http protocol (instead it uses a custom capacitor:// procotol) when loading the app which can cause issues with cookies in general. If you are only building for mobile I would recommend switching to using headers instead of cookies: https://supertokens.com/docs/emailpassword/common-customizations/sessions/token-transfer-method
Alternatively if you wanted to stick with cookies you can refer to this file as inspiration for custom cookie handling: https://github.com/RobSchilderr/capacitor-supertokens-nextjs-turborepo/blob/main/packages/lib/utils/capacitorCookieHandler.ts Note that you will have to pass this as the cookie handler when initialising SuperTokens on the frontend
s
do I still need to confiure custom cookie handler if I use
headers
instead of
cookies
? And if so, how can I pass the cookie handler when initialising SuperTokens?
n
Yes you need to configure the cookie handler even with headers. When calling SuperTokens.init you pass it along with the rest of the config
s
worked like a charm! Thank you very much for the help! 😎
11 Views