History

use HTTP header for access token added for XMLHttpRequest

Stephen Birarda committed 10 years ago

Commit 08dc9e01 parent b4b5c641 file · +4 −4Browse files

Showing the changes to libraries/script-engine/src/XMLHttpRequestClass.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/XMLHttpRequestClass.cpp+4−4
@@ -144,12 +144,12 @@ void XMLHttpRequestClass::open(const QString& method, const QString& url, bool a · 143 unmodified lines
144144 auto accountManager = DependencyManager::get<AccountManager>();
145145
146146 if (accountManager->hasValidAccessToken()) {
147− QUrlQuery urlQuery(_url.query());
148− urlQuery.addQueryItem("access_token", accountManager->getAccountInfo().getAccessToken().token);
149− _url.setQuery(urlQuery);
147+ static const QString HTTP_AUTHORIZATION_HEADER = "Authorization";
148+ QString bearerString = "Bearer " + accountManager->getAccountInfo().getAccessToken().token;
149+ _request.setRawHeader(HTTP_AUTHORIZATION_HEADER.toLocal8Bit(), bearerString.toLocal8Bit());
150150 }
151−
152151 }
152+
153153 if (!username.isEmpty()) {
154154 _url.setUserName(username);
155155 }