homebridge-melcloud-control 4.0.0-beta.362 → 4.0.0-beta.363

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.362",
4
+ "version": "4.0.0-beta.363",
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/melcloud.js CHANGED
@@ -298,7 +298,7 @@ class MelCloud extends EventEmitter {
298
298
  const url = data.url;
299
299
  const codeVerifier = data.codeVerifier;
300
300
  const code = await melCloudHomeToken.loginToMelCloudHome(url);
301
- const token = await melCloudHomeToken.getTokens(code, codeVerifier);
301
+ //const token = await melCloudHomeToken.getTokens(code, codeVerifier);
302
302
 
303
303
  const accountInfo = { ContextKey: code, UseFahrenheit: false };
304
304
  this.contextKey = code;
@@ -157,7 +157,14 @@ class MelCloudHomeToken extends EventEmitter {
157
157
  const redirectUrl = response.headers.location;
158
158
  if (this.logWarn) this.emit('warn', `Redirect URL: ${redirectUrl}`);
159
159
 
160
-
160
+ const getResp = await this.client.get('https://melcloudhome.com/dashboard', {
161
+ headers: {
162
+ 'Accept': 'text/html',
163
+ },
164
+ withCredentials: true,
165
+ });
166
+
167
+ if (this.logWarn) this.emit('warn', `Redirect URL found code: ${getResp.data}, ${getResp.headers}`);
161
168
 
162
169
  const match = redirectUrl.match(/[?&]code=([^&]+)/);
163
170
  if (match) {