From 99a7780decb06cb26e1d58cbbf67b82200d8e742 Mon Sep 17 00:00:00 2001 From: Leo Mehlig Date: Fri, 10 May 2024 14:33:15 +0200 Subject: [PATCH] Update Sources/Auth/AuthClient.swift Co-authored-by: Guilherme Souza --- Sources/Auth/AuthClient.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Sources/Auth/AuthClient.swift b/Sources/Auth/AuthClient.swift index dcf63887..7f46fcaa 100644 --- a/Sources/Auth/AuthClient.swift +++ b/Sources/Auth/AuthClient.swift @@ -698,17 +698,16 @@ public final class AuthClient: Sendable { /// If using ``SignOutScope/others`` scope, no ``AuthChangeEvent/signedOut`` event is fired. /// - Parameter scope: Specifies which sessions should be logged out. public func signOut(scope: SignOutScope = .global) async throws { - let accessToken = currentSession?.accessToken + guard let accessToken = currentSession?.accessToken else { + configuration.logger?.warning("signOut called without a session") + return + } if scope != .others { await sessionManager.remove() eventEmitter.emit(.signedOut, session: nil) } - guard let accessToken else { - throw AuthError.sessionNotFound - } - do { _ = try await api.execute( .init(