Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWTExpired errors after leaving the app open for a short while #85

Open
spakanati opened this issue Oct 27, 2022 · 5 comments
Open

JWTExpired errors after leaving the app open for a short while #85

spakanati opened this issue Oct 27, 2022 · 5 comments
Assignees
Labels
Investigate Working to figure out what's wrong!

Comments

@spakanati
Copy link
Contributor

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.

@MichalNemec
Copy link
Contributor

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.

@mhadaily mhadaily self-assigned this Dec 4, 2022
@mhadaily mhadaily added bug Something isn't working Investigate Working to figure out what's wrong! and removed bug Something isn't working labels Dec 4, 2022
@mhadaily
Copy link
Contributor

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

@arckid
Copy link

arckid commented Feb 12, 2023

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?

@mhadaily
Copy link
Contributor

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)

@arckid
Copy link

arckid commented Feb 12, 2023

Hi,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Working to figure out what's wrong!
Projects
None yet
Development

No branches or pull requests

4 participants