homebridge-nest
homebridge-nest copied to clipboard
Error: Unauthorized
I think I might have failed on step 14 during installation. I think I may have had the token in the config.json file while running Homebridge.
Now, when I run Homebridge I get the following errors:
{ Error: UNAUTHORIZED: {"error":"unauthorized","type":"https://developer.nest.com/documentation/cloud/error-messages#auth-error","message":"unauthorized","instance":"aeaf048c-d733-4454-8f57-60fc6ef31b69"}
at Yg (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:150:468)
at Object.Cc (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:149:255)
at /usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:182:177
at Rh.h.Jd (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:186:104)
at Fh.Jd (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:176:364)
at wh.Jg (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:174:280)
at zh (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:168:464)
at Client.Ka.onmessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/lib/firebase-node.js:167:321)
at Client.dispatchEvent (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:22:30)
at Client._receiveMessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/api.js:134:10)
at Client.
Easy to fix: edit your config.json and remove the token (but make sure you have the code you got from the nest website), restart homebridge and you should see a log message like this:
[1/7/2017, 11:04:11 PM] CODE IS ONLY VALID ONCE! Update config to use {'token':'c.vkK123459835692835629385729385729385729385729385729358723598rN'}
Then you can edit config.json one more time, delete the code, and add the token with double quotes like this:
"token" : "c.vkK123459835692835629385729385729385729385729385729358723598rN"
Thanks! That worked!
Alex Steinman
On Jan 8, 2017, 2:16 AM -0500, Zach Friedland [email protected], wrote:
Easy to fix: edit your config.json and remove the token (but make sure you have the code you got from the nest website), restart homebridge and you should see a log message like this: [1/7/2017, 11:04:11 PM] CODE IS ONLY VALID ONCE! Update config to use {'token':'c.vkK123459835692835629385729385729385729385729385729358723598rN'} Then you can edit config.json one more time, delete the code, and add the token with double quotes like this: "token" : "c.vkK123459835692835629385729385729385729385729385729358723598rN" — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hello,
I am new to Homebridge and the Nest plugin but have tried to figure out how to find the generated token that is being referred to in this thread and Step 14 of the README but cannot do so.
Below is the output I get when I have put in a new code from the Nest development page link into my config.json, and leave out the line with the "token." I believe the next step is to find the token generated and thus edit the config.json with that token to add the "token" line however I do not know in what log to find this token as alluded to above.
Any assistance would be greatly appreciated.
Here is my config.json:
`{ "bridge": { "name": "Homebridge", "username": "B8:27:EB:C1:25:4D", "port": 46521 "pin": "031-45-154" },
"platforms": [{
"platform": "Nest",
"clientId": "4235bef0-8001-47cb-b2f0-449ae7eeb8a3",
"clientSecret": "df0zl5FMDGDkznBiPBc7vGxr7G",
"code": "8ZPRDDCZ",
"username": "username",
"password": "password"
},
{
"platform": "config",
"name": "Config",
"port": 8080,
"log": "/var/log/homebridge.stdout.log",
"error_log": "/var/log/homebridge.stderr.log",
"restart": "/usr/local/bin/supervisorctl restart homebridge"
}
]
}`
Output:
`[2017-10-30 02:39:31] [Nest] Initializing Nest platform...
[2017-10-30 02:39:31] [Nest] Fetching Nest devices.
[2017-10-30 02:39:31] [Config] Initializing config platform...
[2017-10-30 02:39:33] [Config] Console is listening on port 8080.
[2017-10-30 02:39:34] [Nest] Auth failed which likely means the code is no longer valid. Should be able to generate a new one at https://home.nest.com/login/oauth2?client_id=4235bef0-8001-47cb-b2f0-449ae7eeb8a3&state=STATE
[2017-10-30 02:39:34] [Nest] { StatusCodeError: 400 - {"error":"oauth2_error","error_description":"client secret not found","instance_id":"df7c7b95-4d6d-4fb0-8045-1d4bb5cba9c9"}
at new StatusCodeError (/usr/lib/node_modules/homebridge-nest/node_modules/request-promise/lib/errors.js:26:15)
at Request.RP$callback [as _callback] (/usr/lib/node_modules/homebridge-nest/node_modules/request-promise/lib/rp.js:68:32)
at Request.self.callback (/usr/lib/node_modules/homebridge-nest/node_modules/request/request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.
┌────────────┐
│ 031-45-154 │
└────────────┘
[2017-10-30 02:39:34] Homebridge is running on port 46521. `
I have the same thing and stuck in the cycle of generating a new code, adding it to config.json file, restarting Homebridge, and the cycle continues. If anyone can help I would greatly appreciate it.
FOLLOWUP: I didn't realize that I needed to have "token" : "token number" in my json file. I had the token # where the code had been. Once I figured that out I am good to go.
This is no longer the canonical repo for this module. Please file a bug here: https://github.com/chrisjshull/homebridge-nest/issues/new/choose