1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix for basic auth with @ in username

This commit is contained in:
Ben Hardill 2021-06-11 14:25:18 +01:00
parent 4acb66fb7a
commit bcb6d1cf93
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7

View File

@ -207,12 +207,18 @@ module.exports = function(RED) {
}
if (this.credentials) {
if (this.authType === "basic") {
var cred = ""
if (this.credentials.user) {
opts.username = this.credentials.user;
// opts.username = this.credentials.user;
cred = this.credentials.user
}
if (this.credentials.password) {
opts.password = this.credentials.password;
// opts.password = this.credentials.password;
cred += ":" + this.credentials.password
}
// build own basic auth header
// Workaround for https://github.com/sindresorhus/got/issues/1169
opts.headers.Authorization = "Basic " + Buffer.from(cred).toString("base64");
} else if (this.authType === "digest") {
let digestCreds = this.credentials;
let sentCreds = false;