homebridge-lg-thinq-2 2.0.8 → 2.0.9

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## v2.0.9
4
+
5
+ ### Login
6
+
7
+ * When LG locks sign-in for an account (LG message `Need Sign-In Unlock`, usually after several failed sign-ins or a sign-in from a new device), the Homebridge UI, the `thinq` command, and the log now explain what happened and how to unlock it, instead of showing LG's raw message. Documented the error in the README troubleshooting table.
8
+
3
9
  ## v2.0.8
4
10
 
5
11
  ### Security
package/README.md CHANGED
@@ -218,6 +218,7 @@ Turn on Homebridge **debug mode** (Homebridge UI → Settings) to see detailed l
218
218
  | --- | --- |
219
219
  | `LG pre-login failed: Request failed with status code 403` | LG rejected the login request. Update to version `2.0.3` or later. |
220
220
  | `Request failed with status code 429` or result code `9012` | LG received too many requests. Update to version `2.0.6` or later, and do not set a low `refresh_interval`. |
221
+ | `LG has locked sign-in for this account` (LG message `Need Sign-In Unlock`) | LG locked sign-in, usually after several failed sign-ins or a sign-in from a new device. Sign in to the LG ThinQ app or to your LG account on the LG website and complete the verification LG asks for, then try again. Or get a refresh token with [`thinq auth`](#command-line-tool), which uses LG's sign-in page. |
221
222
  | `Missing required config parameter.` | Set `country`, `language`, and either a `refresh_token` or `username` and `password`. |
222
223
  | `The plugin requires a Node.js version of ...` | Update the plugin. Node.js 26 also needs Homebridge `2.3.0` or later. |
223
224
  | A device is missing | Check that it works in the LG ThinQ app. Legacy devices need `"thinq1": true`. If it is still missing, [request it](https://github.com/santiagosony/homebridge-lg-thinq-2/issues/new/choose). |
package/dist/lib/Auth.js CHANGED
@@ -46,6 +46,16 @@ export function authErrorMessage(err, fallback) {
46
46
  || (errorCause(err) ? authErrorMessage(errorCause(err), fallback) : null)
47
47
  || fallback;
48
48
  }
49
+ export const SIGN_IN_UNLOCK_MESSAGE = 'LG has locked sign-in for this account and asks to unlock it '
50
+ + '(LG message: "Need Sign-In Unlock"). This usually happens after several failed sign-ins or a sign-in '
51
+ + 'from a new device. Sign in to the LG ThinQ app or to your LG account on the LG website and complete '
52
+ + 'the verification LG asks for, then try again. You can also get a refresh token with the "thinq auth" '
53
+ + 'command, which uses the LG sign-in page.';
54
+ // LG answers sign-ins to a locked account with a message like
55
+ // "Need Sign-In Unlock:420:<masked email>:Y".
56
+ export function isSignInUnlockRequired(message) {
57
+ return typeof message === 'string' && /sign-?in\s*unlock/i.test(message);
58
+ }
49
59
  function authError(context, err) {
50
60
  const message = authErrorMessage(err, 'Request failed.');
51
61
  const error = new AuthenticationError(`${context}: ${message}`);
@@ -121,6 +131,9 @@ export class Auth {
121
131
  if (code === 'MS.001.03') {
122
132
  throw new AuthenticationError('Your account was already used to registered in ' + message + '.');
123
133
  }
134
+ if (isSignInUnlockRequired(message)) {
135
+ throw new AuthenticationError(SIGN_IN_UNLOCK_MESSAGE);
136
+ }
124
137
  throw new AuthenticationError(message);
125
138
  });
126
139
  // dynamic get secret key for emp signature
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge LG ThinQ 2",
3
3
  "name": "homebridge-lg-thinq-2",
4
- "version": "2.0.8",
4
+ "version": "2.0.9",
5
5
  "description": "Community-maintained continuation of homebridge-lg-thinq: a Homebridge plugin for controlling/monitoring LG ThinQ devices via the LG ThinQ platform.",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",