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

RefreshToken() should take an optional refresh token from the caller #32

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

RedChops
Copy link
Contributor

In the case of RetrieveSessionAsync(), if the user's session is expired, we will not have a CurrentSession instance set yet. In this case, the RefreshToken from the expired session should be provided to RefreshToken(). Additionally, RefreshToken() should persist the new session retrieved from the API.

  • Note: In the current release, the application will crash in RefreshToken because nothing sets CurrentSession before it's called on initialization; this felt like a cleaner route to provide that dependency rather than setting CurrentSession immediately before calling the function only for it to be changed immediately after. Additionally, there was nothing to persist the newly retrieved sessions so if the application restarted after a refresh, it would be in an unrecoverable state.

…n needs to be able to take in a refreshToken as a parameter for renewing expired tokens
@acupofjose acupofjose merged commit 306695d into supabase-community:master Apr 27, 2022
@acupofjose
Copy link
Contributor

acupofjose commented Apr 27, 2022

Great stuff, clean implementation! Appreciate the PR, very helpful!

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