Failure when finding a refresh token in a non OIDC login (#2377)

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
Mauro
2024-01-25 13:35:26 +01:00
committed by GitHub
parent a9460cc06f
commit 99a31cab00
4 changed files with 18 additions and 1 deletions
@@ -122,6 +122,18 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
deviceId: deviceID)
}
let refreshToken = try? await Task.dispatch(on: .global()) {
try client.session().refreshToken
}
if refreshToken != nil {
MXLog.warning("Refresh token found for a non oidc session, can't restore session, logging out")
_ = await Task.dispatch(on: .global()) {
try? client.logout()
}
return .failure(.sessionTokenRefreshNotSupported)
}
return await userSession(for: client)
} catch {
MXLog.error("Failed logging in with error: \(error)")
@@ -34,8 +34,8 @@ enum AuthenticationServiceError: Error {
case slidingSyncNotAvailable
case accountDeactivated
case failedLoggingIn
case isOnWaitlist
case sessionTokenRefreshNotSupported
}
protocol AuthenticationServiceProxyProtocol {