diff --git a/README.md b/README.md index faf7d69..668bedb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins) [![Discord](https://img.shields.io/discord/432663330281226270?color=728ED5&logo=discord&label=discord)](https://discord.gg/j5WwJTB) -Nest plug-in for [Homebridge](https://github.com/nfarina/homebridge) using the native Nest API. See what's new in [release 4.6.1](https://github.com/chrisjshull/homebridge-nest/releases/tag/v4.6.1). +Nest plug-in for [Homebridge](https://github.com/nfarina/homebridge) using the native Nest API. See what's new in [release 4.6.2](https://github.com/chrisjshull/homebridge-nest/releases/tag/v4.6.2). Integrate your Nest Thermostat, Temperature Sensors, Nest Protect, and Nest x Yale Lock devices into your HomeKit system. Both Nest Accounts (pre-August 2019) and Google Accounts are supported. diff --git a/lib/nest-connection.js b/lib/nest-connection.js index ae20d59..bc4fe9d 100644 --- a/lib/nest-connection.js +++ b/lib/nest-connection.js @@ -154,7 +154,7 @@ class Connection { if (this.config.googleAuth) { let issueToken = this.config.googleAuth.issueToken; let cookies = this.config.googleAuth.cookies; - + req = { method: 'GET', // followAllRedirects: true, @@ -169,7 +169,7 @@ class Connection { } }; result = (await axios(req)).data; - googleAccessToken = result.access_token; + googleAccessToken = result.access_token; } else if (this.config.refreshToken) { req = { method: 'POST', @@ -275,7 +275,7 @@ class Connection { 'cookie': 'G_ENABLED_IDPS=google; eu_cookie_accepted=1; viewer-volume=0.5; cztoken=' + this.config.access_token } }; - } else if (!this.config.googleAuth && !this.config.authenticator) { + } else if (!this.config.googleAuth && !this.config.refreshToken && !this.config.authenticator) { this.error('Nest account login by username/password is no longer supported.'); return false; @@ -336,7 +336,7 @@ class Connection { } try { - if (!this.config.authenticator && !this.config.googleAuth && !this.config.access_token && (!rcToken || !rcKey)) { + if (!this.config.authenticator && !this.config.refreshToken && !this.config.googleAuth && !this.config.access_token && (!rcToken || !rcKey)) { // Recaptcha failed - throw throw({code: 'ENORECAPTCHA'}); } @@ -420,7 +420,7 @@ class Connection { } } - let isGoogle = this.config.googleAuth || this.config.authenticator; + let isGoogle = this.config.refreshToken || this.config.googleAuth || this.config.authenticator; // Google tokens expire after 60 minutes (Nest is 30 days), so refresh just before that to make sure we always have a fresh token if (this.preemptiveReauthTimer) { clearTimeout(this.preemptiveReauthTimer); diff --git a/package.json b/package.json index 2c68747..67d5721 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "prepublishOnly": "npm run lint", "preversion": "npm run lint" }, - "version": "4.6.1", + "version": "4.6.2", "warnings": [ { "code": "ENOTSUP", @@ -43,7 +43,7 @@ "node": ">=7.0.0", "homebridge": ">=0.2.5" }, - "pkgid": "homebridge-nest@4.6.1" + "pkgid": "homebridge-nest@4.6.2" } ] }