Closed shgtjgh closed 2 years ago
Hi @shgtjgh,
I've had the same issue and fixed it by adding
rejectUnauthorized: false
to bmwrequest.js in the var Options 🙂👍🏼
Hi SAR71, sorry for reacting so late, but on holiday! Can you elaborate a bit more: I cannot find a bmwrequest.js; the optionfolder in var is empty; where do i put what. I'am an experienced digibeet ;-)
Hi @shgtjgh,
sure :-) You can find the file in this folder: /home/pi/MagicMirror/modules/MMM-BMWConnected/lib
There you have to add rejectUnauthorized: false like this:
// Credits for original code to Nils Schneider: https://github.com/Lyve1981/BMW-ConnectedDrive-JSON-Wrapper
var https = require("https");
exports.call = function (_host, _path, _postData, _token, _tokenType, _callbackSuccess, _callbackError) {
var hasToken = typeof (_token) === "string" && _token.length > 0;
var options = {
hostname: _host,
port: '443',
path: _path,
method: hasToken ? 'GET' : 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(_postData)
},
rejectUnauthorized: false
};
if (hasToken) {
options.headers['Authorization'] = _tokenType + " " + _token;
}
const req = https.request(options, function (res) {
var data = "";
res.setEncoding('utf8');
res.on('data', function (chunk) {
data += chunk;
});
res.on('end', function () {
_callbackSuccess(data, res.headers);
});
});
req.on('error', function (e) {
_callbackError(e);
});
req.write(_postData);
req.end();
};
I hope that helps you :-)
Have a great weekend!
Hi SAR71, GREAT!!!! WORKS AS IT SHOULD BE! Thx
Hi @shgtjgh ,
You're welcome :-) Don't know what it exactly does and if there are any problems in the future, but at least it works :-)
since Yesterday MagicMirror is just loading, but not showing. anyone els. ca.6months ago same issue did it perfect afterwards. help