diff --git a/crates/matrix-sdk/src/client/futures.rs b/crates/matrix-sdk/src/client/futures.rs index b239e06d5..562d12056 100644 --- a/crates/matrix-sdk/src/client/futures.rs +++ b/crates/matrix-sdk/src/client/futures.rs @@ -19,15 +19,9 @@ use std::{fmt::Debug, future::IntoFuture}; use eyeball::SharedObservable; #[cfg(not(target_arch = "wasm32"))] use eyeball::Subscriber; -#[cfg(feature = "experimental-oidc")] -use mas_oidc_client::{ - error::{ - Error as OidcClientError, ErrorBody as OidcErrorBody, HttpError as OidcHttpError, - TokenRefreshError, TokenRequestError, - }, - types::errors::ClientErrorCode, -}; use matrix_sdk_common::boxed_into_future; +#[cfg(feature = "experimental-oidc")] +use oauth2::{basic::BasicErrorResponseType, RequestTokenError}; use ruma::api::{client::error::ErrorKind, error::FromHttpResponseError, OutgoingRequest}; #[cfg(feature = "experimental-oidc")] use tracing::error; @@ -121,19 +115,12 @@ where #[cfg(feature = "experimental-oidc")] RefreshTokenError::Oidc(oidc_error) => { - match **oidc_error { - OidcError::Oidc(OidcClientError::TokenRefresh( - TokenRefreshError::Token(TokenRequestError::Http( - OidcHttpError { - body: - Some(OidcErrorBody { - error: ClientErrorCode::InvalidGrant, - .. - }), - .. - }, - )), - )) => { + match &**oidc_error { + OidcError::RefreshToken(RequestTokenError::ServerResponse( + error_response, + )) if *error_response.error() + == BasicErrorResponseType::InvalidGrant => + { error!("Token refresh: OIDC refresh_token rejected with invalid grant"); // The refresh was denied, signal to sign out the user. client.broadcast_unknown_token(soft_logout);