homebridge-melcloud-control 4.0.0-beta.377 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.377",
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",
@@ -50,7 +50,7 @@ class MelCloudHomeToken extends EventEmitter {
50
50
  code_verifier: codeVerifier,
51
51
  });
52
52
 
53
- const tokenResponse = await this.client.post(TOKEN_ENDPOINT, tokenData.toString(), {
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];