homebridge-melcloud-control 4.0.0-beta.376 → 4.0.0-beta.378
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/melcloudhometoken.js +4 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.378",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/melcloudhometoken.js
CHANGED
|
@@ -21,7 +21,7 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
21
21
|
this.logError = config.logError;
|
|
22
22
|
|
|
23
23
|
const jar = new CookieJar();
|
|
24
|
-
this.
|
|
24
|
+
this.client = wrapper(axios.create({ jar, withCredentials: true }));
|
|
25
25
|
this.client.defaults.headers['User-Agent'] = MOBILE_USER_AGENT;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -50,7 +50,7 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
50
50
|
code_verifier: codeVerifier,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
const tokenResponse = await this.client.post(
|
|
53
|
+
const tokenResponse = await this.client.post(this.redirectUrl, tokenData.toString(), {
|
|
54
54
|
headers: {
|
|
55
55
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
56
56
|
'Authorization': 'Basic aG9tZW1vYmlsZTo=',
|
|
@@ -114,6 +114,8 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
114
114
|
if (this.logWarn) this.emit('warn', `Redirect URL: ${redirectUrl}`);
|
|
115
115
|
if (this.logWarn) this.emit('warn', `Response headers: ${response.headers}`);
|
|
116
116
|
|
|
117
|
+
this.redirectUrl = redirectUrl;
|
|
118
|
+
|
|
117
119
|
const match = redirectUrl.match(/[?&]code=([^&]+)/);
|
|
118
120
|
if (match) {
|
|
119
121
|
const code = match[1];
|