fix(apple): Don't try to sign in if user cancels (#7996)

This fixes a minor regression introduced in f779fe9667 where we would
incorrectly show an error dialog if the user cancels sign in because the
`authResponse` is invalid.
This commit is contained in:
Jamil
2025-02-03 05:47:33 +00:00
committed by GitHub
parent bbea85687a
commit 6842e044b7

View File

@@ -22,12 +22,14 @@ struct WebAuthSession {
let anchor = PresentationAnchor()
let authResponse = try await withCheckedThrowingContinuation { continuation in
let authResponse: AuthResponse? = try await withCheckedThrowingContinuation { continuation in
let session = ASWebAuthenticationSession(url: url, callbackURLScheme: scheme) { returnedURL, error in
do {
if let error = error as? ASWebAuthenticationSessionError,
error.code == .canceledLogin {
// User canceled sign in
continuation.resume(returning: nil)
return
} else if let error = error {
throw error
}
@@ -50,7 +52,9 @@ struct WebAuthSession {
session.start()
}
try await store.signIn(authResponse: authResponse)
if let authResponse {
try await store.signIn(authResponse: authResponse)
}
}
}