Use friendly user agent during webflow2 auth
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 6 Oct 2020 15:28:20 +0000 (17:28 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Thu, 8 Oct 2020 05:55:47 +0000 (05:55 +0000)
This way the server displays a less scary string while granting access
from the browser. Also this same string will be used in the "Devices and
sessions" section of the server settings.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/creds/flow2auth.cpp

index b4e826d46bd2b22de53e95e29fdd11427fddeb22..790318e835fcebe6529ca5973773eef58af5efab 100644 (file)
@@ -82,6 +82,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action)
     // add 'Content-Length: 0' header (see https://github.com/nextcloud/desktop/issues/1473)
     QNetworkRequest req;
     req.setHeader(QNetworkRequest::ContentLengthHeader, "0");
+    req.setRawHeader("User-Agent", Utility::friendlyUserAgentString());
 
     auto job = _account->sendRequest("POST", url, req);
     job->setTimeout(qMin(30 * 1000ll, job->timeoutMsec()));