chrisjshull / homebridge-nest

Nest plugin for HomeBridge
707 stars 111 forks source link

Cant Authorize Nest Account #523

Closed slvrscoobie closed 2 years ago

slvrscoobie commented 2 years ago

nest was authorized noticed today it wasn't working. I re-did the steps to get the cookie and urls. says its
data: { error: 'invalid_request', error_description: 'Missing required parameter: scope' } }, isAxiosError: true, toJSON: [Function: toJSON], status: 400 } [3/7/2022, 10:40:58 PM] [Nest] Access token acquisition via googleAuth failed (code 400). [3/7/2022, 10:40:58 PM] [Nest] Unable to authenticate with Google/Nest. To Reproduce Steps to reproduce the behavior: use nest cookie method - fails to authenticate

Expected behavior

Include with your bug report this version info:

node --version - v16.14.0
homebridge --version - 

Node.js Version | v16.13.1
-- | --
v6.14.15

Error: Request failed with status code 400 at createError (/volume1/@appdata/homebridge/lib/node_modules/homebridge-nest/node_modules/axios/lib/core/createError.js:16:15) at settle (/volume1/@appdata/homebridge/lib/node_modules/homebridge-nest/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/volume1/@appdata/homebridge/lib/node_modules/homebridge-nest/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) { config: {

I also see this same Axios error when trying to google Login.JS method as well. nest-master-2/login.js node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'axios' Require stack:

adriancable commented 2 years ago
  1. If you get an error with the cookies method it means you've not pasted the issueToken or cookies correctly. Without you sharing those, I have no way of telling you what you did wrong.

  2. For the refresh token method, why are you running node login.js from the (redacted)/homebridge-nest-master-2 folder? The instructions tell you to run node login.js from the folder where you have installed the plug-in, which from your cut-and paste is: /volume1/@appdata/homebridge/lib/node_modules/homebridge-nest

slvrscoobie commented 2 years ago

My cookie is the same method /‘copy paste from the last like 4 times I’ve done this. Not sure how I’m supposed to paste my cookie here as I don’t want to share it. it’s the same cookie:5 lines of text )without cookie included. And the url. It’s worked before. Here are edited versions. googleAuth": { "issueToken": "https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&login_hint=AJDLj6LQu-SMCQLMJfOUep6S7tCel-HwaDz7lUSuGG-te28cVDVq2IJ94gIeqTNMFuPQ&client_id=733249279899-44tchle2kaa9afr5v9ov7jbuojfr9lrq.apps.googleusercontent.com&origin=https%3A%2F%2Fhome.nest.com", "cookies": "SIDCC=AJi4QfFBiZtiVImtGk-aupSzFbP0YyqNfd5V9CwUJoXzvSa7MK1DSsSLYF5ZIH2vdiJ9ES-F; Secure-3PSIDCC=AJi4QfFg4yozcUhjaHw0R8MF5dc7bRMyJTIOn-; Host-GAPS=1:XCo8f0V2EsVUgyxLWtqJCwoO4KjxzwaE1F5rwxXk0sTObxIfLMeXqX88MxcsPc2m-U69ceWW_PikMkvu_ctc2LxgE4OlkQ:sgrInXgHlp1NGltK; user_id=110664151452098438615; APISID=LxQsCLH5ZCdbf1-5/AOtHjwIUMz0ymBVY6; HSID=ARCNYnS92tO5K5Ufe; NID=511=oNzxUxZb6CAXuaS5aZclciJfjqtivNPKIB7M5wgAkx0wfgwGw0nI7w1ajbA6PqW_1aLiPb2bhaxGzN3WAaqRJ0bggkLaeF1jkNmYRb1mfEvlTgcQSoYAErYLVvH3TZTgHg41ZOODyEdzlKK7G8UwpWEphKw0VxvNAnNCxVGJGOCsZvkuBD1NrQN5-ZP2XjKEq4GDbw; SAPISID=29g-eXTevaTRnvuE/A_TuplFNXSNZg7TCF; SID=HwhhNnrgOvy7QTxg4RI8bm81TGnEE30T-g3FxFY3O1gA1Azb-KUEdB-KAMWD_WGHLNyRqA.; SSID=AURhzgk7KQMX0t9-l; Secure-1PAPISID=29g-eXTevaTRnvuE/A_TuplFNXSNZg7TCF; Secure-1PSID=HwhhNnrgOvy7QTxg4RI8bm81TGnEE30T-g3FxFY3O1gA1Azbv6AQf2-qmilmUkvdi1W8Jg.; Secure-3PAPISID=29g-eXTevaTRnvuE/A_TuplFNXSNZg7TCF; Secure-3PSID=HwhhNnrgOvy7QTxg4RI8bm81TGnEE30T-g3FxFY3O1gA1AzbS70M-E_JDB4Y1IeX_QFw4A.; ACCOUNT_CHOOSER=AFx_qI4wUdMSIwbGU1kZMIwcysDlq6EPbLUNBuJeM3EOyv_gReg8AkYW9mLNtAbA6I8lbAQ_7q7e29-oAdYkb3-voFj-0v21bM8epMjP2WL23_3MGF_FC8o7PtPxD9KdYJ9wU6oZQoBW; LSID=o.store.google.com|s.youtube:HwhhNur0HWtH1KlueQdofAfe2ihpTYZF_TLvn0pCw3RVK0-zm7RWF9z0lB4xlfvC5rSTEQ.; __Host-1PLSID=o.store.google.com|s.youtube:HwhhNur0HWtH1KlueQdofAfe2ihpTYZF_TLvn0pCw3RVK0-zsnCcfr6j5z2Xvz60e9qq1Q.; __Host-3PLSID=o.store.google.com|s.youtube:HwhhNur0HWtH1KlueQdofAfe2ihpTYZF_TLvn0pCw3RVK0-zLvQd6IMjhBwZo6LaDRRGZQ.; SMSV=ADHTe-DUYmMwfXpqxnLb5WzVoq5jTmWnDb-5kWLxFIWFNhu_WzNrkURgGx0Y1avv_V1oEO1wPv-UfAlU1qgb-kw2kY4zUtshuk-vRQGqJhJZRsUC_0w-jAc", "apiKey": "AIzaSyAdkSIMNc51XGNEAYWasX9UOWkS5P6sZE4" }, "options": [ "Thermostat.Fan.Disable", "HomeAway.Disable" ], "platform": "Nest" },

}

I’m not running home bridge on my Mac. It’s in a docket container on my synology. Not sure how I’d run your js from there. if you could remove my folder name it would be appreciated.

adriancable commented 2 years ago

@slvrscoobie - the issueToken URL in the above is incomplete. It stops at home.nest.com in your cut-and-paste but in the actual URL, there is other stuff after that. When I tried it just now after home.nest.com there was &scope=openid%20profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fnest-account&ss_domain=https%3A%2F%2Fhome.nest.com&include_granted_scopes=true which you've missed out.

Regarding running login.js on your Docker container, you'll need to SSH into the container and run it from there. If you want to run it from your Mac, you'll need to do npm i from the directory you downloaded the plug-in to first to install the dependencies, but there isn't really a reason to do it that way. Just run it in the container.

slvrscoobie commented 2 years ago

Ok. So Don’t stop at nest.com per instruction item 7 for cookie method?

adriancable commented 2 years ago

The instructions do say 'copy the entire Request URL' but since the query parameters can move around, I'll edit the README to make that clearer.

slvrscoobie commented 2 years ago

Roger. I’ll copy the whole thing and test. Thanks for the quick reply.

adriancable commented 2 years ago

Sure thing! Good luck.

slvrscoobie commented 2 years ago

Up and running, thanks for the assistance!