homebridge-melcloud-control 4.0.0-beta.336 → 4.0.0-beta.337
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 +10 -6
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.337",
|
|
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
|
@@ -86,18 +86,22 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
86
86
|
|
|
87
87
|
async getTokens(code, codeVerifier) {
|
|
88
88
|
try {
|
|
89
|
-
const
|
|
89
|
+
const tokenData = new URLSearchParams({
|
|
90
90
|
grant_type: 'authorization_code',
|
|
91
|
-
client_id: CLIENT_ID,
|
|
92
91
|
code: code,
|
|
93
92
|
redirect_uri: REDIRECT_URI,
|
|
93
|
+
client_id: CLIENT_ID,
|
|
94
94
|
code_verifier: codeVerifier,
|
|
95
|
-
})
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const tokenResponse = await axios(TOKEN_ENDPOINT, {
|
|
98
|
+
method: 'POST',
|
|
96
99
|
headers: {
|
|
97
100
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
98
|
-
'
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
'Content-Length': tokenData.toString().length,
|
|
102
|
+
'Authorization': 'Basic aG9tZW1vYmlsZTo=',
|
|
103
|
+
},
|
|
104
|
+
}, tokenData.toString());
|
|
101
105
|
|
|
102
106
|
this.emit('warn', `Token ${tokenResponse.data}`);
|
|
103
107
|
return tokenResponse.data;
|