diff --git a/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift b/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift index 992b2bfe..f3021089 100644 --- a/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift +++ b/Sources/NextcloudKitUI/Views/Login/LoginFlowModel.swift @@ -113,6 +113,12 @@ final class LoginFlowModel: QRCodeParsing, URLSanitizing { return } + // HTTP 404 means the flow is still pending; any other failure is terminal. + if poll.error != .success, poll.responseData?.response?.statusCode != 404 { + self.endLogin(poll.error) + return + } + try? await Task.sleep(for: .seconds(1)) } }