homebridge-xbox-tv 2.8.26-beta.21 → 2.8.26-beta.23
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/webApi/authentication.js +8 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.8.26-beta.
|
|
4
|
+
"version": "2.8.26-beta.23",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -211,13 +211,8 @@ class AUTHENTICATION extends EventEmitter {
|
|
|
211
211
|
this.tokens = JSON.parse(tokens);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
if (this.
|
|
216
|
-
if (!this.tokens.oauth.refresh_token) {
|
|
217
|
-
reject('No oauth token found. Use authorization manager first.');
|
|
218
|
-
return;
|
|
219
|
-
};
|
|
220
|
-
|
|
214
|
+
if (this.clientId) {
|
|
215
|
+
if (this.tokens.oauth.refresh_token) {
|
|
221
216
|
try {
|
|
222
217
|
await this.refreshTokens('user');
|
|
223
218
|
await this.saveTokens(this.tokens);
|
|
@@ -225,14 +220,14 @@ class AUTHENTICATION extends EventEmitter {
|
|
|
225
220
|
} catch (error) {
|
|
226
221
|
reject(error);
|
|
227
222
|
};
|
|
228
|
-
} else if (this.userToken && this.userHash) {
|
|
229
|
-
resolve({ headers: `XBL3.0 x=${this.userHash};${this.userToken}`, tokens: this.tokens });
|
|
230
223
|
} else {
|
|
231
|
-
reject('
|
|
224
|
+
reject('No oauth token found. Use authorization manager first.')
|
|
232
225
|
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
}
|
|
226
|
+
} else if (this.userToken && this.userHash) {
|
|
227
|
+
resolve({ headers: `XBL3.0 x=${this.userHash};${this.userToken}`, tokens: this.tokens });
|
|
228
|
+
} else {
|
|
229
|
+
reject('Not authorized, check plugin setting client Id.');
|
|
230
|
+
}
|
|
236
231
|
|
|
237
232
|
await new Promise(resolve => setTimeout(resolve, 900000));
|
|
238
233
|
this.updateAuthorization();
|