1Password Passage Auth For iOS - Unclear Error Messaging

69 Views Asked by At

I receive this errors from the below implementation:

error: The operation couldn’t be completed. (Passage.PassageASAuthorizationError error 5.) ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "(null)"

I'm working through the iOS-specific implementation of Passage Auth. Using the example code here:

https://docs.passage.id/mobile/ios/get-started#register-new-user

I've created a simple Registration as a start, but having a really hard time understanding the failure points or what may be configured wrong when passing an Email. Here's my SwiftUI:

        VStack {
            TextField("Email", text: $identifier)
                .textFieldStyle(.roundedBorder)
            Button("Register", action: registerNewUser)
//            Button("Log In", action: loginWithPasskey)
            
        }
        .alert("Success", isPresented: $isShowingSuccessAlert) {} message: {
            Text("Auth token: \(authToken)")
        }
        .alert("Failure", isPresented: $isShowingFailureAlert) {}
        .padding()
    }

    func registerNewUser() {
        Task {
            do {
                let result = try await passage.register(identifier: identifier)
                if let token = result.authResult?.authToken {
                    print(token)
                } else if let authFallbackResult = result.authFallbackResult {
                    print(authFallbackResult)
                }
            } catch {
                print("error: \(error.localizedDescription)")
            }
        }
    }

Followed all the setup steps from Passage docs. Seems like this framework is still new enough that few folks have posted resources or helpers related to implementing this framework for native iOS.

0

There are 0 best solutions below