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



commit 855c9ee8e0f4ffe6ec142fe053bdeeea5812e0f9
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Thu Feb 10 14:36:28 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
    
    Fix https://gitlab.gnome.org/GNOME/fractal/-/issues/934

 src/session/mod.rs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/session/mod.rs b/src/session/mod.rs
index 38898962c..96e5fa702 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]