nhost / nhost-dart

Nhost Dart & Flutter packages

Home Page:https://nhost.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JWTExpired errors after leaving the app open for a short while

spakanati opened this issue · comments

I'm seeing JWTExpired errors when leaving the app open for a bit, suggesting the token refresh is not working correctly. It's a dealbreaker right now in terms of being able to use nhost in production because after a fairly short amount of time the app breaks because all queries/mutations/subscriptions stop executing and you have to refresh the entire app.

Similar to #21 but the errors I'm seeing are for any type of operation, not just subscriptions, so I don't think it's purely a websocket problem. I also saw nhost/nhost#405 and it seems that the JS library had a very similar issue, so it might be that the Dart/Flutter library needs to implement the same logic to make sure that the app does not allow the JWT to expire.

Did you try simple implementation of this without any extra code?
i am leaving my app open when i.e. eating lunch and it never yelled at me, that the token expired.
After like 2 months of using it, i didnt have this problem once.

Can you try latest BETA version https://pub.dev/packages/nhost_sdk/versions/4.0.0-dev.8

It reuiqres you to pass subdomain and region

commented

It's still there in 4.0.0.dev.13

User gets logged out after some time, automatically. Using all dependencies with 3.x-dev.x versions. Any hints?

please use new package https://pub.dev/packages/nhost_dart
I will depreciate the old package soon.

There is a maximum expiry date for the token however refresh token is issued, therefore, you can silently call the Refresh method to renew the token. This will avoid logout user

Please see this #91 (comment)

commented

Hi,

Thanks for the quick update. Will go through it and let you know how it goes!