[fractal/fractal-next] session: force_auth in RequestConfig



commit 53a11894ceef3a807b0de8215f64a387d629b30a
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Fri Feb 11 17:16:58 2022 +0100

    session: force_auth in RequestConfig
    
    This will send the auth_token to every request, fixing the issue with
    some matrix servers that requires authentication to get the user
    profile and other possible issues with different servers configurations
    and other API endpoints.
    
    This change is based on this matrix-rust-sdk comment:
    https://github.com/matrix-org/matrix-rust-sdk/issues/488#issuecomment-1034917858
    
    There's also an update of the matrix-rust-sdk with a fix for the login
    with force_auth option:
    https://github.com/matrix-org/matrix-rust-sdk/commit/4b5aae11235aca19eba5d4e8594c5dcfdb621b5f
    
    Fix https://gitlab.gnome.org/GNOME/fractal/-/issues/934

 Cargo.lock         | 10 +++++-----
 src/session/mod.rs | 10 ++++++++--
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 35236a1a..aefdfeb6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2263,7 +2263,7 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
 [[package]]
 name = "matrix-qrcode"
 version = "0.2.0"
-source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#a4a50db4f31da7b9116f77c71f318fcc859de8fc";
+source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#cb8a156b3ac13138398354d75e0b766143fdc660";
 dependencies = [
  "base64",
  "byteorder",
@@ -2277,7 +2277,7 @@ dependencies = [
 [[package]]
 name = "matrix-sdk"
 version = "0.4.1"
-source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#a4a50db4f31da7b9116f77c71f318fcc859de8fc";
+source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#cb8a156b3ac13138398354d75e0b766143fdc660";
 dependencies = [
  "anymap2",
  "async-stream",
@@ -2306,7 +2306,7 @@ dependencies = [
 [[package]]
 name = "matrix-sdk-base"
 version = "0.4.1"
-source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#a4a50db4f31da7b9116f77c71f318fcc859de8fc";
+source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#cb8a156b3ac13138398354d75e0b766143fdc660";
 dependencies = [
  "chacha20poly1305",
  "dashmap",
@@ -2332,7 +2332,7 @@ dependencies = [
 [[package]]
 name = "matrix-sdk-common"
 version = "0.4.1"
-source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#a4a50db4f31da7b9116f77c71f318fcc859de8fc";
+source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#cb8a156b3ac13138398354d75e0b766143fdc660";
 dependencies = [
  "async-lock",
  "async-trait",
@@ -2348,7 +2348,7 @@ dependencies = [
 [[package]]
 name = "matrix-sdk-crypto"
 version = "0.4.1"
-source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#a4a50db4f31da7b9116f77c71f318fcc859de8fc";
+source = 
"git+https://github.com/jsparber/matrix-rust-sdk.git?branch=messages-api#cb8a156b3ac13138398354d75e0b766143fdc660";
 dependencies = [
  "aes 0.7.5",
  "aes-gcm",
diff --git a/src/session/mod.rs b/src/session/mod.rs
index 38898962..96e5fa70 100644
--- a/src/session/mod.rs
+++ b/src/session/mod.rs
@@ -309,7 +309,10 @@ impl Session {
                     .collect()
             };
             let config = ClientConfig::new()
-                .request_config(RequestConfig::new().retry_limit(2))
+                // force_auth option to solve an issue with some servers configuration to require
+                // auth for profiles:
+                // https://gitlab.gnome.org/GNOME/fractal/-/issues/934
+                .request_config(RequestConfig::new().retry_limit(2).force_auth())
                 .passphrase(passphrase.clone())
                 .store_path(path.clone());
 
@@ -361,7 +364,10 @@ impl Session {
     pub fn login_with_previous_session(&self, session: StoredSession) {
         let handle = spawn_tokio!(async move {
             let config = ClientConfig::new()
-                .request_config(RequestConfig::new().retry_limit(2))
+                // force_auth option to solve an issue with some servers configuration to require
+                // auth for profiles:
+                // https://gitlab.gnome.org/GNOME/fractal/-/issues/934
+                .request_config(RequestConfig::new().retry_limit(2).force_auth())
                 .passphrase(session.secret.passphrase.clone())
                 .store_path(session.path.clone());
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]