1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

implement usage of Authorization-Header instead of query-param for access_token

This commit is contained in:
Krombel
2017-06-16 12:33:42 +02:00
parent 4ccec13739
commit e0a5edeb04

View File

@@ -385,8 +385,20 @@ module.exports.MatrixHttpApi.prototype = {
if (!queryParams) {
queryParams = {};
}
if (!queryParams.access_token) {
queryParams.access_token = this.opts.accessToken;
if (isFinite(opts)) {
// opts used to be localTimeoutMs
opts = {
localTimeoutMs: opts,
};
}
if (!opts) {
opts = {};
}
if (!opts.headers) {
opts.headers = {};
}
if (!opts.headers.Authorization) {
opts.headers.Authorization = "Bearer " + this.opts.accessToken;
}
const request_promise = this.request(