[evolution-ews/wip/mcrha/office365: 45/50] EM365Connection: Provided SoupAuth might not be always used by libsoup




commit 40e96f8a0626df3d36e8fb892d76c7375639dc5c
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 28 17:34:59 2020 +0200

    EM365Connection: Provided SoupAuth might not be always used by libsoup

 src/Microsoft365/common/e-m365-connection.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/Microsoft365/common/e-m365-connection.c b/src/Microsoft365/common/e-m365-connection.c
index 74886871..8fd461fd 100644
--- a/src/Microsoft365/common/e-m365-connection.c
+++ b/src/Microsoft365/common/e-m365-connection.c
@@ -99,6 +99,7 @@ m365_connection_utils_ensure_bearer_auth_usage (SoupSession *session,
                                                SoupMessage *message,
                                                ESoupAuthBearer *bearer)
 {
+       SoupAuthManager *auth_manager;
        SoupSessionFeature *feature;
        SoupURI *soup_uri;
 
@@ -124,7 +125,12 @@ m365_connection_utils_ensure_bearer_auth_usage (SoupSession *session,
 
        g_return_if_fail (soup_uri != NULL);
 
-       soup_auth_manager_use_auth (SOUP_AUTH_MANAGER (feature), soup_uri, SOUP_AUTH (bearer));
+       auth_manager = SOUP_AUTH_MANAGER (feature);
+
+       /* This will make sure the 'bearer' is used regardless of the current 'auth_manager' state.
+          See https://gitlab.gnome.org/GNOME/libsoup/-/issues/196 for more information. */
+       soup_auth_manager_clear_cached_credentials (auth_manager);
+       soup_auth_manager_use_auth (auth_manager, soup_uri, SOUP_AUTH (bearer));
 
        soup_uri_free (soup_uri);
 }


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