homebridge-flume 3.0.2-beta.0 → 3.0.2
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/CHANGELOG.md +6 -0
- package/lib/connection/http.js +16 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/connection/http.js
CHANGED
|
@@ -57,9 +57,6 @@ export default class {
|
|
|
57
57
|
}
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
|
-
// Log the response if in debug mode
|
|
61
|
-
this.log.debug('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
|
|
62
|
-
|
|
63
60
|
// Check to see we got a proper response
|
|
64
61
|
if (!res.data.data || !res.data.data[0]) {
|
|
65
62
|
this.log.warn('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
|
|
@@ -71,6 +68,12 @@ export default class {
|
|
|
71
68
|
this.refreshToken = res.data.data[0].refresh_token;
|
|
72
69
|
this.expiresIn = now + res.data.data[0].expires_in;
|
|
73
70
|
|
|
71
|
+
// Log the response if in debug mode
|
|
72
|
+
this.log.debug(
|
|
73
|
+
'[HTTP obtainToken()] %s.',
|
|
74
|
+
JSON.stringify(res.data).replaceAll(this.accessToken, '[redacted]').replaceAll(this.refreshToken, '[redacted]'),
|
|
75
|
+
);
|
|
76
|
+
|
|
74
77
|
// Obtain the user ID
|
|
75
78
|
this.userId = jwtDecode(this.accessToken).user_id;
|
|
76
79
|
|
|
@@ -123,8 +126,17 @@ export default class {
|
|
|
123
126
|
throw new Error(platformLang.noDataReceived);
|
|
124
127
|
}
|
|
125
128
|
|
|
129
|
+
// Make the token available in other functions
|
|
130
|
+
this.accessToken = res.data.data[0].access_token;
|
|
131
|
+
this.refreshToken = res.data.data[0].refresh_token;
|
|
132
|
+
this.expiresIn = now + res.data.data[0].expires_in;
|
|
133
|
+
|
|
126
134
|
// Log the response if in debug mode
|
|
127
|
-
|
|
135
|
+
// Redact the access token and refresh token
|
|
136
|
+
this.log.debug(
|
|
137
|
+
'[HTTP renewToken()] %s.',
|
|
138
|
+
JSON.stringify(res.data).replaceAll(this.accessToken, '[redacted]').replaceAll(this.refreshToken, '[redacted]'),
|
|
139
|
+
);
|
|
128
140
|
|
|
129
141
|
/*
|
|
130
142
|
{
|
|
@@ -146,11 +158,6 @@ export default class {
|
|
|
146
158
|
pagination: null
|
|
147
159
|
}
|
|
148
160
|
*/
|
|
149
|
-
|
|
150
|
-
// Make the token available in other functions
|
|
151
|
-
this.accessToken = res.data.data[0].access_token;
|
|
152
|
-
this.refreshToken = res.data.data[0].refresh_token;
|
|
153
|
-
this.expiresIn = now + res.data.data[0].expires_in;
|
|
154
161
|
return true;
|
|
155
162
|
} catch (err) {
|
|
156
163
|
if (err.code && platformConsts.httpRetryCodes.includes(err.code)) {
|