mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39: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:
parent
a9460cc06f
commit
99a31cab00
@ -186,6 +186,10 @@ final class SoftLogoutScreenCoordinator: CoordinatorProtocol {
|
||||
case .oidcError(.userCancellation):
|
||||
// No need to show an error, the user cancelled authentication.
|
||||
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:
|
||||
viewModel.displayError(.alert(L10n.errorUnknown))
|
||||
}
|
||||
|
@ -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 {
|
||||
|
1
changelog.d/2365.bugfix
Normal file
1
changelog.d/2365.bugfix
Normal file
@ -0,0 +1 @@
|
||||
If a refresh token is found in a non OIDC session, the app will be logged out.
|
Loading…
x
Reference in New Issue
Block a user