diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index 1336ad8..b166c66 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -640,11 +640,11 @@ exit:
 }
 
 static void
-authentication_session_execute (EAuthenticationSession *session,
-                                gint io_priority,
-                                GCancellable *cancellable,
-                                GAsyncReadyCallback callback,
-                                gpointer user_data)
+authentication_session_execute_helper (EAuthenticationSession *session,
+				       gint io_priority,
+				       GCancellable *cancellable,
+				       GAsyncReadyCallback callback,
+				       gpointer user_data)
 {
 	GSimpleAsyncResult *simple;
 	AsyncContext *async_context;
@@ -669,6 +669,75 @@ authentication_session_execute (EAuthenticationSession *session,
 	g_object_unref (simple);
 }
 
+struct AuthSessionExecuteData
+{
+	EAuthenticationSession *session;
+	gint io_priority;
+	GCancellable *cancellable;
+	GAsyncReadyCallback callback;
+	gpointer user_data;
+};
+
+static gboolean
+auth_session_execute_mainthread_cb (gpointer user_data)
+{
+	struct AuthSessionExecuteData *ase = user_data;
+
+	g_return_val_if_fail (ase != NULL, FALSE);
+	g_return_val_if_fail (ase->session != NULL, FALSE);
+
+	authentication_session_execute_helper (
+		ase->session,
+		ase->io_priority,
+		ase->cancellable,
+		ase->callback,
+		ase->user_data);
+
+	g_object_unref (ase->session);
+	if (ase->cancellable)
+		g_object_unref (ase->cancellable);
+	g_free (ase);
+
+	return FALSE;
+}
+
+static void
+authentication_session_execute (EAuthenticationSession *session,
+                                gint io_priority,
+                                GCancellable *cancellable,
+                                GAsyncReadyCallback callback,
+                                gpointer user_data)
+{
+	g_return_if_fail (E_IS_AUTHENTICATION_SESSION (session));
+
+	/* is this run with default main context? */
+	if (g_main_context_get_thread_default () == NULL ||
+	    g_main_context_get_thread_default () == g_main_context_default ()) {
+		authentication_session_execute_helper (session, io_priority, cancellable, callback, user_data);
+	} else {
+		/* it's required to have result of the 'simple' delivered
+		   on the default main context, aka on the main thread,
+		   otherwise, if the current thread-default context is freed
+		   before the result is delivered, then the request will be
+		   never finished, causing stale authentication requests
+		*/
+
+		struct AuthSessionExecuteData *ase;
+
+		ase = g_new0 (struct AuthSessionExecuteData, 1);
+		ase->session = g_object_ref (session);
+		ase->io_priority = io_priority;
+		ase->cancellable = cancellable;
+		ase->callback = callback;
+		ase->user_data = user_data;
+
+		if (ase->cancellable)
+			g_object_ref (ase->cancellable);
+
+		g_timeout_add (1, auth_session_execute_mainthread_cb, ase);
+	}
+}
+
 static EAuthenticationSessionResult
 authentication_session_execute_finish (EAuthenticationSession *session,
                                        GAsyncResult *result,
