homebridge-melcloud-control 4.0.0-beta.322 → 4.0.0-beta.323

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.322",
4
+ "version": "4.0.0-beta.323",
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
@@ -297,7 +297,7 @@ class MelCloud extends EventEmitter {
297
297
 
298
298
  const data = await melCloudHomeToken.buildAuthorizeUrl();
299
299
  const code = await melCloudHomeToken.loginToMelCloudHome(data.url);
300
- const token = await melCloudHomeToken.getTokens(code);
300
+ const token = await melCloudHomeToken.getTokens(code, data.codeVerifier);
301
301
 
302
302
  return false
303
303
 
@@ -83,13 +83,14 @@ class MelCloudHomeToken extends EventEmitter {
83
83
  }
84
84
  }
85
85
 
86
- async getTokens(code) {
86
+ async getTokens(code, codeVerifier) {
87
87
  try {
88
88
  const tokenResponse = await axios.post(TOKEN_ENDPOINT, new URLSearchParams({
89
89
  grant_type: 'authorization_code',
90
90
  client_id: CLIENT_ID,
91
91
  code: code,
92
- redirect_uri: REDIRECT_URI
92
+ redirect_uri: REDIRECT_URI,
93
+ code_verifier: codeVerifier,
93
94
  }).toString(), {
94
95
  headers: {
95
96
  'Content-Type': 'application/x-www-form-urlencoded'