https://supertokens.com/ logo
Title
b

beagle

10/08/2022, 10:08 AM
Hi, I asked a while ago how I can implement Supertokens in an Ionic app. I was then referred to the page "Localstorage instead of cookies" (https://supertokens.com/docs/emailpassword/advanced-customizations/examples/localstorage/about), which also helped me a lot. Now, after a while, the access token expires and has to be refreshed. Supertokens also makes the Api call "refresh" automatically and it seems to work, but the Api endpoint still responds with ``401 try to refresh token``. This leads to an endless loop. If I now restart the page within the Ionic app, everything works again and the api always returns a 200 from now on, until the time when the access token expires again. I don't understand why this is happening. I manually set the header entry st-cookie in the app and the BackEnd reads this and overwrites the cookie entry. Am I doing something wrong? Thx
r

rp

10/08/2022, 10:09 AM
hey @beagle
@porcellus had made this example app - I think he will be the best to be able to help out. In case there is a bug in the example app, we will fix it as well
p

porcellus

10/08/2022, 10:14 AM
Hi. So the fact that a restart fixes it points to it not being re-read for some reason
Either that, or the cookies are cleaned after restart and there is some kind of issue there. I have to leave in a few minutes and I'll only be back in few hours, but I'll check this out later today.
b

beagle

10/08/2022, 10:20 AM
Yes, great, no stress at all, thank you very much 🙂
Does it help if I build an example application, which could then also be put into examples?
p

porcellus

10/08/2022, 10:22 AM
An ionic specific one? I think that'd be awesome.
b

beagle

10/08/2022, 10:22 AM
well then I'll do that
So, I have been working on the example and my current status can be seen here https://github.com/renehauck/supertokens-auth-react/tree/with-ionic in the folder "with-ionic". Since it is a bit of work, I wanted to ask if this suits you, then I would continue to work on it, or is it going in the wrong direction?
p

porcellus

10/08/2022, 2:56 PM
I'll let @rp answer this (although it's getting late in his TZ), but I think it's looking good. It combines a few things (nestjs+gql+ionic) into a single example but I don't think that's an issue; it actually showcases a few things we don't have an example for.
r

rp

10/08/2022, 3:12 PM
As long as it works standalone and is easy to install and run with a clear readme, it would work well for us. I would suggest that you make the folder name “with-ionic” into something more specific like “with-ionic-nestjs-graphql”
b

beagle

10/09/2022, 8:37 AM
ok thanks for the feedback. The "easy to start" could possibly be a small problem. Of course, in order to launch the Ionic app, an environment must first be created on the computer that allows an Android/Ios app to be started.
r

rp

10/09/2022, 8:42 AM
Oh yea. I mean as long as someone has all of that setup. Whatever is expected by ionic to work.
Also, the connectionURI on the backend should be https://try.supertokens.com