Skip to content

Commit

Permalink
Simplify fingerprint handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-vysotskyi-cko committed Sep 18, 2024
1 parent 9a2833d commit f2867da
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,10 @@ final class DefaultCustomerActionsService: CustomerActionsService {
throw POFailure(message: message, code: .internal(.mobile), underlyingError: nil)
}
do {
let returnUrl = try await withTimeout(
Constants.webFingerprintTimeout,
error: POFailure(code: .timeout(.mobile)),
perform: {
try await self.webSession.authenticate(using: url)
}
)
let queryItems = URLComponents(string: returnUrl.absoluteString)?.queryItems
return queryItems?.first { $0.name == "token" }?.value ?? ""
let timeoutError = POFailure(code: .timeout(.mobile))
return try await withTimeout(Constants.webFingerprintTimeout, error: timeoutError) {
try await self.redirect(url: url.absoluteString)
}
} catch let failure as POFailure where failure.code == .timeout(.mobile) {
// Fingerprinting timeout is treated differently from other errors.
let response = AuthenticationResponse(url: url, body: Constants.fingerprintTimeoutResponseBody)
Expand Down

0 comments on commit f2867da

Please sign in to comment.