mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
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:
+4
@@ -186,6 +186,10 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
|||||||
case .oidcError(.userCancellation):
|
case .oidcError(.userCancellation):
|
||||||
// No need to show an error, the user cancelled authentication.
|
// No need to show an error, the user cancelled authentication.
|
||||||
break
|
break
|
||||||
|
case .sessionTokenRefreshNotSupported:
|
||||||
|
// We should display a specific error saying that we do not support this kind of login
|
||||||
|
// But the copy is TBD
|
||||||
|
viewModel.displayError(.alert(L10n.errorUnknown))
|
||||||
default:
|
default:
|
||||||
viewModel.displayError(.alert(L10n.errorUnknown))
|
viewModel.displayError(.alert(L10n.errorUnknown))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,18 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
|||||||
deviceId: deviceID)
|
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)
|
return await userSession(for: client)
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed logging in with error: \(error)")
|
MXLog.error("Failed logging in with error: \(error)")
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ enum AuthenticationServiceError: Error {
|
|||||||
case slidingSyncNotAvailable
|
case slidingSyncNotAvailable
|
||||||
case accountDeactivated
|
case accountDeactivated
|
||||||
case failedLoggingIn
|
case failedLoggingIn
|
||||||
|
|
||||||
case isOnWaitlist
|
case isOnWaitlist
|
||||||
|
case sessionTokenRefreshNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol AuthenticationServiceProxyProtocol {
|
protocol AuthenticationServiceProxyProtocol {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
If a refresh token is found in a non OIDC session, the app will be logged out.
|
||||||
Reference in New Issue
Block a user