diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 1dbde5a..67bc6d6 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1076,7 +1076,21 @@ static void
 auth_required (SoupSession *session, SoupMessage *msg,
 	       SoupAuth *auth, gboolean retrying)
 {
-	g_signal_emit (session, signals[AUTHENTICATE], 0, msg, auth, retrying);
+	gboolean done = FALSE;
+
+	if (!retrying && soup_auth_is_for_proxy (auth)) {
+		SoupURI *proxy_uri = NULL;
+
+		g_object_get (session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
+
+		if (proxy_uri && proxy_uri->user && *proxy_uri->user) {
+			done = TRUE;
+			soup_auth_authenticate (auth, proxy_uri->user, proxy_uri->password);
+		}
+	}
+
+	if (!done)
+		g_signal_emit (session, signals[AUTHENTICATE], 0, msg, auth, retrying);
 }
 
 static void
