Backport oauth XPC interrupt fix

This commit is contained in:
Jake Barnby
2023-09-14 15:22:10 -04:00
parent 37a38679d6
commit 92264e863a
+7 -8
View File
@@ -939,7 +939,7 @@ open class Account: Service {
success: String? = nil,
failure: String? = nil,
scopes: [String]? = nil
) throws -> Bool {
) async throws -> Bool {
let path: String = "/account/sessions/oauth2/{provider}"
.replacingOccurrences(of: "{provider}", with: provider)
@@ -953,13 +953,12 @@ open class Account: Service {
let query = "?\(client.parametersToQueryString(params: params))"
let url = URL(string: client.endPoint + path + query)!
let callbackScheme = "appwrite-callback-\(client.config["project"] ?? "")"
let group = DispatchGroup()
group.enter()
WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in
group.leave()
try await withCheckedThrowingContinuation { continuation in
WebAuthComponent.authenticate(url: url, callbackScheme: callbackScheme) { result in
continuation.resume(with: result)
}
}
group.wait()
return true
@@ -1374,4 +1373,4 @@ open class Account: Service {
}
}
}