Skip to content

[Bug]: Receive an event .signedIn instead of .passwordRecovery when verify email OTP with type .recovery #863

@vatson1

Description

@vatson1

Version

2.37.0

Platform

iOS

Swift Version

6.0

What happened?

The issue is similar to
supabase/auth-js#349

Steps to Reproduce

  1. Import Supabase
  2. Create a client
    supabase = SupabaseClient(supabaseURL: ..., supabaseKey: ...)
  3. Create a user (can do manually in Supabase UI)
  4. Run a task which will track auth events (can do in AppModel)
        Task {
            for await (event, session) in supabase.auth.authStateChanges {
                await MainActor.run {
                    switch event {
                    case .initialSession:
                        print(event.rawValue)
                    case .passwordRecovery:
                        print(event.rawValue)
                    case .signedIn:
                        print(event.rawValue)
                    case .signedOut:
                        print(event.rawValue)
                    case .tokenRefreshed:
                        print(event.rawValue)
                    default:
                        break
                    }
                }
            }
        }
  1. Trigger sending a recovery email
try await supabase.auth.resetPasswordForEmail(email)
  1. Call OTP verification by the token
try await supabase.auth.verifyOTP(email: email, token: emailConfirmationCode, type: .recovery)
  1. Check the event type received

Actual Result:
Image

Expected Behaviour:
event = passwordRecovery

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