Skip to content

[Bug]: No auth updates #793

@kopyl

Description

@kopyl

Version

2.30.2

Platform

iOS

Swift Version

5

What happened?

Take a look at this code:

func startAuthStateListener() {
    authStateListenerTask?.cancel()

    authStateListenerTask = Task {
        for await (event, session) in supabaseClient.auth.authStateChanges {
            await MainActor.run {
                switch event {
                case .initialSession:
                    print("Initial session: \(session?.user.id ?? UUID())")
                case .signedIn:
                    print("User signed in: \(session?.user.id ?? UUID())")
                case .signedOut:
                    print("User signed out")
                case .passwordRecovery:
                    print("Password recovery")
                case .tokenRefreshed:
                    print("Token refreshed")
                case .userUpdated:
                    print("User updated: \(session?.user.id ?? UUID())")
                case .mfaChallengeVerified:
                    print("MFA challenge verified")
                default:
                    print("default change...")
                }
            }
        }
    }
}

i got ONLY Initial session print event on primary device when i logged out (globally) from secondary device.

I was thinking that maybe you get the sign out even when you sign out from secondary device ONLY after a session on a primary device expires... But this was not the case. After waiting pointlessly for an entire hour in hopes that i will get the event – i got NO sign out even.

I also tries relaunching my app and sending SELECT request hoping that i will get the sign out event (from secondary device) on my primary device, but again – NO EVENTS.

So the question is – how the hell am I supposed to know on a primary device when a user signs out globally on a secondary device???

Steps to Reproduce

...

Code Sample

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions