homebridge-melcloud-control 4.0.0-beta.337 → 4.0.0-beta.338

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.337",
4
+ "version": "4.0.0-beta.338",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -94,17 +94,18 @@ class MelCloudHomeToken extends EventEmitter {
94
94
  code_verifier: codeVerifier,
95
95
  });
96
96
 
97
- const tokenResponse = await axios(TOKEN_ENDPOINT, {
97
+ const tokenResponse = await axios(TOKEN_ENDPOINT, tokenData.toString(), {
98
98
  method: 'POST',
99
99
  headers: {
100
100
  'Content-Type': 'application/x-www-form-urlencoded',
101
101
  'Content-Length': tokenData.toString().length,
102
102
  'Authorization': 'Basic aG9tZW1vYmlsZTo=',
103
103
  },
104
- }, tokenData.toString());
104
+ });
105
+ const tokens = JSON.parse(tokenResponse);
105
106
 
106
- this.emit('warn', `Token ${tokenResponse.data}`);
107
- return tokenResponse.data;
107
+ this.emit('warn', `Token ${tokens}`);
108
+ return tokens;
108
109
  } catch (error) {
109
110
  console.error('Failed to obtain OAuth tokens:', error);
110
111
  throw error;