Skip to content

Commit fad9bec

Browse files
committed
add a signout function to clear cookies
1 parent 6479c42 commit fad9bec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Sources/XcodesLoginKit/Client.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ public class Client {
279279

280280
// MARK: Security Key Authentication
281281
extension Client {
282-
283-
284282
public func submitSecurityKeyPinCode(_ pinCode: String, sessionData: AppleSessionData, authOptions: AuthOptionsResponse) async throws -> AuthenticationState {
285283
guard let fsaChallenge = authOptions.fsaChallenge else {
286284
throw AuthenticationError.unexpectedSignInResponse(statusCode: 0, message: "Auth response is not a FSA Challenge type. Security not secure key?")
@@ -315,6 +313,11 @@ extension Client {
315313
self.fido2?.cancel()
316314
}
317315

316+
/// Clears any cookies from URLSession
317+
@MainActor
318+
public func signout() {
319+
Current.network.session.configuration.httpCookieStorage?.removeCookies(since: .distantPast)
320+
}
318321
}
319322

320323
extension Data {

0 commit comments

Comments
 (0)