-
-
Notifications
You must be signed in to change notification settings - Fork 47
Add new event system, add support for error code in OTP links #912
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
base: master
Are you sure you want to change the base?
Conversation
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/status/NotAuthenticatedReason.kt
Fixed
Show fixed
Hide fixed
# Conflicts: # Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/Utils.kt
NotAuthenticatedReason
parameter to SessionStatus.NotAuthenticated
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/status/NotAuthenticatedReason.kt
Outdated
Show resolved
Hide resolved
Just a thought, would it make sense to merge |
Maybe. But that would be too breaking for a minor version, we can leave this thought for v4. |
Planning to refactor this: |
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/status/SessionStatus.kt
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jan-tennert these changes deviates from the official libs, I'd like to better understand its benefits, could you explain?
Specially this new AuthEvent
type.
@grdsdev |
What kind of change does this PR introduce?
Feature
What is the current behavior?
sessionStatus
will get updated toSessionStatus.RefreshFailure(e)
even if its still valid (=no access to the valid session).What is the new behavior?
New event system which exists next to the
sessionStatus
, but works independently. Currently there are two events:AuthEvent.OtpError(...)
- will be emitted if an error code was found in a OTP link (deeplink on Android/iOS, URL on JS and Desktop)AuthEvent.RefreshFailure(cause)
- will be emitted if a session refresh failed (regardless if the session is still valid)This PR also changes the
SessionStatus.RefreshFailure(cause)
:cause
parameter/property is deprecated (use the event for the cause)--> If a refresh failed, an event will always be emitted, but the session status will only get updated if the session also expired. Planning to rename the status in the future to something like
SessionStatus.NeedsRefresh
Additional changes: