homebridge-melcloud-control 4.0.0-beta.335 → 4.0.0-beta.336

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.335",
4
+ "version": "4.0.0-beta.336",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -86,33 +86,7 @@ class MelCloudHomeToken extends EventEmitter {
86
86
 
87
87
  async getTokens(code, codeVerifier) {
88
88
  try {
89
- const payload = {
90
- "client_id": CLIENT_ID,
91
- "grant_type": 'authorization_code',
92
- "code": code,
93
- "redirect_uri": REDIRECT_URI,
94
- "code_verifier": codeVerifier
95
- }
96
-
97
- const postData = QueryString.stringify(payload);
98
- const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
99
- const response = await axios.post(TOKEN_ENDPOINT, postData, headers);
100
- const accessToken = response.data;
101
- this.emit('warn', `Token ${tokenResponse.data}`);
102
-
103
-
104
- //accessToken.issued = new Date().toISOString();
105
- //this.tokens.oauth = accessToken;
106
- //await this.functions.saveData(this.tokensFile, this.tokens);
107
- return accessToken;
108
- } catch (error) {
109
- throw new Error(`Access token error: ${error}`);
110
- }
111
- }
112
-
113
- async getTokens1(code, codeVerifier) {
114
- try {
115
- const tokenResponse = await axios.post(TOKEN_ENDPOINT, new URLSearchParams({
89
+ const tokenResponse = await this.client.post(TOKEN_ENDPOINT, new URLSearchParams({
116
90
  grant_type: 'authorization_code',
117
91
  client_id: CLIENT_ID,
118
92
  code: code,