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

fix: token refresh doesn't block on ClientException #660

Merged
merged 4 commits into from
Oct 7, 2023
Merged

Conversation

Vinzent03
Copy link
Collaborator

@Vinzent03 Vinzent03 commented Oct 5, 2023

Bug fix

What is the current behavior?

When the device is offline the refreshSession takes very long until all retry attempts are done. This may be unexpected and blocks everything when awaited, as seen when using Supabase.initialize(). Additionally, postgrest requests now properly fail with a ClientException when being offline and not waiting endless when access token is expired.

What is the new behavior?

refreshSession finishes after the first requests and throws when request fails. The refresh token timer is started in the background and emits a valid session to the onAuthStateChange stream when available.

Additional context

This is hopefully the last pr to that refresh token offline issue...

close #630

@Vinzent03 Vinzent03 marked this pull request as ready for review October 6, 2023 10:53
@Vinzent03 Vinzent03 merged commit a5ef8b7 into next Oct 7, 2023
8 checks passed
@Vinzent03 Vinzent03 deleted the fix/offline branch October 7, 2023 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants