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

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.339",
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,17 @@ class MelCloudHomeToken extends EventEmitter {
94
94
  code_verifier: codeVerifier,
95
95
  });
96
96
 
97
- const tokenResponse = await axios(TOKEN_ENDPOINT, {
98
- method: 'POST',
97
+ const tokenResponse = await axios.post(TOKEN_ENDPOINT, tokenData.toString(), {
99
98
  headers: {
100
99
  'Content-Type': 'application/x-www-form-urlencoded',
101
100
  'Content-Length': tokenData.toString().length,
102
101
  'Authorization': 'Basic aG9tZW1vYmlsZTo=',
103
102
  },
104
- }, tokenData.toString());
103
+ });
104
+ const tokens = JSON.parse(tokenResponse.data);
105
105
 
106
- this.emit('warn', `Token ${tokenResponse.data}`);
107
- return tokenResponse.data;
106
+ this.emit('warn', `Token ${tokens}`);
107
+ return tokens;
108
108
  } catch (error) {
109
109
  console.error('Failed to obtain OAuth tokens:', error);
110
110
  throw error;