homebridge-nest-cam
homebridge-nest-cam copied to clipboard
[Bug]: Nest Auth doesn't work with FT accounts
Describe the bug
In connection.ts, NEST_AUTH_URL refers to the non-FT URL regardless of whether "fieldTest": true
in the config. This means that Nest Auth does not work for FT accounts:
[5/22/2022, 9:22:54 AM] [Nest-cam] Nest authentication failed (code undefined).
[5/22/2022, 9:22:54 AM] [Nest-cam] Unable to retrieve access token.
I managed to get it working by changing NEST_AUTH_URL = 'https://webapi.camera.home.ft.nest.com/api/v1/login.login_nest'; I also changed Referer: 'https://home.ft.nest.com', both in connection.ts (lines 15 and 238 respectively). Not sure if the change to Referer is necessary,
Would it be possible to make this change to the plugin code so the correct AUTH URL (and Referer URL, if necessary) are chosen depending on whether "fieldTest": true
in the config?
Thank you!
Debug Output
[5/22/2022, 9:22:54 AM] [Nest-cam] Nest authentication failed (code undefined).
[5/22/2022, 9:22:54 AM] [Nest-cam] Unable to retrieve access token.
Steps to reproduce
include '"fieldTest": true` and 'nest_token' in the config, and use an FT token.
Device Type
RPi 4
iOS Version
n/a
Camera Types
All
Bug Persistence
Consistently
Last Working Version
No response
Thanks for the catch! I've published a new test version (v7.5.1-test.2). You can install it via the UI (Previous Versions). Let me know if this fixes your issue.
Thanks! I've done that but I still get:
[5/28/2022, 10:20:00 PM] Loaded plugin: [email protected]
...
[5/28/2022, 10:20:02 PM] [Nest-cam] Nest authentication failed (code undefined).
[5/28/2022, 10:20:02 PM] [Nest-cam] Unable to retrieve access token.
Looking at the test.2 code in connection.ts, I don't see any changes to reflect the new FT URL?
Ya just noticed that too.. test.3 is now up. Let me know if that works.
Same issue, and still don't see any changes to NEST_AUTH_URL to refer to the FT URL :)
I just realized you are using the old Nest authentication instead of Google :) Whoops. Try test.4 and see if you see changes now.
No joy I'm afraid...
[6/11/2022, 6:17:33 PM] [Nest-cam] Nest authentication failed (code undefined).
[6/11/2022, 6:17:33 PM] [Nest-cam] Unable to retrieve access token.
[6/11/2022, 6:17:42 PM] [Nest-cam] Error checking alerts: 403
Troubleshoot here: https://git.io/Jtxww
[6/11/2022, 6:17:42 PM] [Nest-cam] Error checking alerts: 403
Troubleshoot here: https://git.io/Jtxww
I've checked the token and it's still valid and working with the rudimentary changes I made here: https://github.com/no1knows/homebridge-nest-cam-ft/blob/master/src/nest/connection.ts
Hm. Not sure what else it could be. You can see the changes in this commit: c885217c27f5838c859c953ea50bf99b9049e580
I just added the ft flag to the old nest auth.
I went ahead and published v7.5.1 with the above changes. Let me know if they still don't work. This version has a few other fixes as well.
Thanks! Still no luck, but I have no idea why looking at your changes (i.e. they LGTM, but I really am no expert):
[6/22/2022, 7:44:44 AM] [Nest-cam] Error checking alerts: 403 Troubleshoot here: https://git.io/Jtxww
Here's my config:
"nest_token": "[known good token from https://home.ft.nest.com/session]",
"options": {
"fieldTest": true,
"ffmpegCodec": "libx264",
"streamQuality": 3,
"alertCheckRate": 10,
"alertCooldownRate": 180,
"alertTypes": [
"Motion",
"Sound",
"Person",
"Package Delivered",
"Package Retrieved",
"Face",
"Zone"
],
"importantOnly": true,
"motionDetection": true,
"streamingSwitch": true,
"chimeSwitch": false,
"announcementsSwitch": false,
"doorbellAlerts": true,
"doorbellSwitch": false,
"audioSwitch": false
},
"platform": "Nest-cam"
}
Is there debug logging I can enable?
You can enable debug logging in the UI settings.
Thanks. No additional relevant logs are shown. My only changes were to the NEST_AUTH_URL and Referer URL, which I think is all you've changed (albeit in your case depending on whether "fieldTest": true), and yet my fork works. Does my config above LGTY? If so, I'm at a loss.
I was able to fix this locally with the following changes:
- src/nest/connection.ts#L223: fix referer to be https://home.ft.nest.com instead of https://home.nest.ft.com
- src/nest/connection.ts#L222 : Remove default false value for the ft argument to make sure all nest_auth callers specify it
- src/nest/connection.ts#L255: Pass ft to nest_auth
- src/index.ts#L335: Pass ft to nest_auth
Sent you https://github.com/Brandawg93/homebridge-nest-cam/pull/512
I've merged and published v7.5.3. Thanks @tronikos!
If anyone still experiences issues, feel free to reopen this.