homebridge-nest
homebridge-nest copied to clipboard
Authentication expiring after 30 min - 5 hrs (Nest and Google Accounts)
Describe the bug
When authenticating a Nest account with the access_token, it stops working after 30 minutes with Auth failed: access token specified in Homebridge configuration rejected
I then did the Google account authentication (with issueToken and cookies) and it also expired after 5 hours.
I did not log out, I closed the browser tab, and the Nest home.nest.com/session shows expires_in: "Thu, 05-Oct-2023 07:36:22 GMT"
, but after 30 minutes it asks to login again.
To Reproduce Steps to reproduce the behavior:
- Authenticate with either Nest or Google cookies
- 30 minutes for Nest and 5 hours for Google cookies
Can confirm, seeing same issue.
Same here. I just installed Homebridge two days ago and added the Nest integration. I first tried the Nest authentication (by error) and that token no longer worked after 20ish minutes. I then tried the Google authentication method and that token stopped working after a few hours. I can confirm my account uses Google authentication to log in. I went through the procedure 3 different times to get a new token but it stops working after a few hours each time
It would appear this is user error since it's only a few of us. Any tips for troubleshooting this?
Agreed, I tried various methods including finding the API token from a header with no luck either... I'm not too sure what next, I also recall one of the iframe/oauth2 URL's was different, or I would get an invalid UTF character error for one but not another (?), but I was setting up late at night and I do not remember what process I did, I will try experimenting again soonish
I also saw somewhere (Don't remember, maybe it was a fork of this repo?) saying that only google chrome browsers work, firefox or others don't give the right token??
Same issue, re-entered the session several times, works for 30mins at most.
I also saw somewhere (Don't remember, maybe it was a fork of this repo?) saying that only google chrome browsers work, firefox or others don't give the right token??
I'm on Chrome so this might not be the issue (at least for me)
Same issue with Chrome and I even tried the HOOBS Nest Sidecar addon to get the information (it was the same as I was extracting).
Yeah I'm not having any luck with the HOOBS Nest Sidecar extension either (Edge or Chrome). The values work for a little while in Homebridge but then just stop working.
Same, worked for a bit now wont auth already. Shoot thought i finally got it back in homekit.
Have the same issue both google and nest authentication methods time out after a couple of hours.
Auth failed: access token specified in Homebridge configuration rejected
I have been having issues with this for a minute now. I'm going to end up trying homebridge-google-nest-sdm but the only thing that sucks with that is you have an initial fee from google.
@adriancable @chrisjshull I hope one of you can help.
This issue has been persisting for approx. a month, but I don't know what has caused it. Google/Nest website authentication changes or something else? It blanks all nest responses, e.g. in homebridge it shows nest current temperature as 0 degC, etc.
Update:
Going to https://home.nest.com/session shows:
"expires_in": "Sat, 04-Nov-2023 10:13:14 GMT",
Then refreshing a few minutes later shows:
"expires_in": "Sat, 04-Nov-2023 10:16:40 GMT",
I was expecting that session expires_in is indefinate, i.e. so far in the future the session will never expire. Have I misunderstood this?
The times it has been repaired, i,e, logged out, logged back in again, and capturing details, it seems to work for approx. 50-60 mins, here is a log on the periods it works with:
General Info:
04 Oct 2023 - 12:46:27 - Fully logged out of Edge browser, logged back in, it displayed the nest home page, AND kept tab open in browser.
04 Oct 2023 - 13:41:24 - Stopped reported true current temperature and reverted back to 0 degC
From Homebridge Logs:
[10/4/2023, 12:46:27 PM] [Nest] initing thermostat "Thermostat Thermostat": deviceId: <REDACTED> structureId: <REDACTED>
[Thermostat Thermostat@@Heating Threshold Temperature] characteristic was supplied illegal value: number 0 exceeded minimum of 9
[10/4/2023, 12:46:27 PM] [Nest] initing home_away_sensor "Home Occupied": deviceId: <REDACTED> structureId: <REDACTED>
[10/4/2023, 12:56:11 PM] [Homebridge UI] Starting terminal session
[10/4/2023, 1:40:55 PM] [Homebridge UI] Terminal session ended.
[10/4/2023, 1:41:24 PM] [Nest] Google authentication was unsuccessful. Make sure you did not log out of your Google account after getting your googleAuth parameters.
{
error: 'USER_LOGGED_OUT',
detail: 'No active session found.',
status: undefined
}
[10/4/2023, 1:41:24 PM] [Nest] Access token acquisition via googleAuth failed (code USER_LOGGED_OUT).
[10/4/2023, 1:46:22 PM] [Nest] Reauthenticating on Nest service ...
[10/4/2023, 1:46:22 PM] [Nest] Google authentication was unsuccessful. Make sure you did not log out of your Google account after getting your googleAuth parameters.
[10/4/2023, 1:46:22 PM] [Nest] Access token acquisition via googleAuth failed (code USER_LOGGED_OUT).
{
error: 'USER_LOGGED_OUT',
detail: 'No active session found.',
status: undefined
}
[10/4/2023, 1:46:23 PM] [Nest] Auth failed: access token specified in Homebridge configuration rejected
[10/4/2023, 1:46:23 PM] [Nest] API observe: error not_connected
[10/4/2023, 1:46:23 PM] [Nest] ^^^^^ this message is for information only, it does not mean there is a problem, please do not
file a ticket unless you actually have a problem with the function of the plug-in
[10/4/2023, 1:46:23 PM] [Nest] Retrying in 10 seconds.
[10/4/2023, 2:36:28 PM] [Nest] Google authentication was unsuccessful. Make sure you did not log out of your Google account after getting your googleAuth parameters.
[10/4/2023, 2:36:28 PM] [Nest] Access token acquisition via googleAuth failed (code USER_LOGGED_OUT).
{
error: 'USER_LOGGED_OUT',
detail: 'No active session found.',
status: undefined
}
[10/4/2023, 2:36:28 PM] [Nest] Auth failed: access token specified in Homebridge configuration rejected
The above errors keep repeating forever.
I think there is something in google auth that auto de-auth and re-auths, maybe chrome profiles, maybe some other mechanism. I was looking through their oauth and security and gave up after a bit.
I have used Edge so unlikely to be Chrome profiles as the issue........
On Thu, 5 Oct 2023, 5:35 pm Shawn A, @.***> wrote:
I think there is something in google auth that auto de-auth and re-auths, maybe chrome profiles, maybe some other mechanism. I was looking through their oauth and security and gave up after a bit.
— Reply to this email directly, view it on GitHub https://github.com/chrisjshull/homebridge-nest/issues/630#issuecomment-1749278127, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDYCAQ7JOLKYTAYVHGUP2LX53OVPAVCNFSM6AAAAAA4LK3PHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBZGI3TQMJSG4 . You are receiving this because you commented.Message ID: @.***>
I used firefox to get my auth data
Possibly relevant: https://support.google.com/googlenest/answer/9293712
tl;dr: Google killed "Works With Nest" connections which likely is the cause of this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Possibly relevant: https://support.google.com/googlenest/answer/9293712
tl;dr: Google killed "Works With Nest" connections which likely is the cause of this
I don't think this is related since WWN was deprecated on 9/29 and the issue was reported here almost a month prior. I'm still seeing this issue on my end but I'm not sure what could be causing it.
Still having issues too:
[12/12/2023, 12:11:09 PM] [Nest] Google authentication was unsuccessful. Make sure you did not log out of your Google account after getting your googleAuth parameters.
{
error: 'USER_LOGGED_OUT',
detail: 'No active session found.',
status: undefined
}
[12/12/2023, 12:11:09 PM] [Nest] Access token acquisition via googleAuth failed (code USER_LOGGED_OUT).
[12/12/2023, 12:11:09 PM] [Nest] Unable to authenticate with Google/Nest.
[12/12/2023, 12:11:09 PM] [Nest] NOTE: Because we couldn't connect to the Nest service, your Nest devices in HomeKit will not be responsive.
I'm experiencing the same auth timeout as well; running Firefox on MacOS. The integration works for 30+ minutes and then presents the same error as others.
Same issue on my end as well
Encountering the same issue. I had used this plugin successfully around a year ago, but now (after moving and trying to get my homelab setup again) it’s no longer functional due to this issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I managed to find a workaround to this issue. First, I should state that I am using the "Using a Google Account" --> Cookie method. I figured the fundamental issue was that this integration is working like a standard web session and timing out due to inactivity. The key is keeping the session alive. But, I suspect if you configure a basic time-based keep-alive, Google's session algorithm would realise it's not user interactivity and kill the session. So, I thought about randomising the 'keep-alive'.
My workaround was to set up several HomeKit automations using various sensors. When those sensors detect motion, they trigger the Nest Occupancy sensor to "On". This effectively sends an API push using your session information to set your Home/Away status to "Home". Even if you are already "Home", the update is sent and keeps things 'alive'.
I've used this setup for a week so far and it's been flawless.
Limitations:
- It assumes you have sensors to trigger the automation.
- If you have pets, it might trigger the Home status when you are in fact away. I made sure the only sensors that can trigger the update are not those that would be triggered by pets.
- If you are away for an extended period of time/holiday, the session might ultimately time out. So, you might want to combine this with another form of keep-alive or simply reconnect if the session does drop.
- In order for this to work, you have to disable Nest's built-in Home/Away assistance. I didn't have a problem with this, because I found it to be useless anyway (turning to Away when I was Home, even with location tracking enabled). But, I again used HomeKit automations to set to "Away" when I am not at home, which again, works flawlessly.
Hope this helps!
For the developers of this module, I wonder if it's possible to build in some kind of randomised keep-alive which would negate the need for this workaround...
Nice I figured it was something like this. I wonder if there is a session option to disable this via a cookie or static auth token
@NathObeaN - this is almost certainly a placebo. Cookie expiry times can vary massively from one day/week to the next.
The plug-in is constantly talking to the Nest service using the cookies, every few seconds. Adding additional 'talk' over the same API endpoints by e.g. changing a setting will not make things any better.
@adriancable you may well be right. I will continue to test over time and report back. All I can say is that I tested for about a week without any workaround in place and I was consistently timing out after 30~ mins with no activity, and if I kept the session "chatty" then it would stay open for the day, but then time out over night. This happened consistently for a week. Ever since the workaround, the session has stayed up, over 2 weeks now. It could be coincidence, but we'll see. I will report back if anything changes.
I have been having issues with this for a minute now. I'm going to end up trying homebridge-google-nest-sdm but the only thing that sucks with that is you have an initial fee from google.
I just switched to the SDM-based plugin. Paid Google the $5 and went through the complicated setup instructions, but seem to have it working. Of course, I'll have to wait a few days to confirm it still works when the token expires and it needs to refresh it. Also, it won't take a snapshot "on demand" so it just shows the Nest/Google logos in the thumbnails until you actually start the stream (or an event has recently occurred).
I have been having issues with this for a minute now. I'm going to end up trying homebridge-google-nest-sdm but the only thing that sucks with that is you have an initial fee from google.
I just switched to the SDM-based plugin. Paid Google the $5 and went through the complicated setup instructions, but seem to have it working. Of course, I'll have to wait a few days to confirm it still works when the token expires and it needs to refresh it. Also, it won't take a snapshot "on demand" so it just shows the Nest/Google logos in the thumbnails until you actually start the stream (or an event has recently occurred).
I tried the SDM variant also and it works fine, but it’s more limited - no Nest Protect support and no hot water support to name the most important to me.
For what it’s worth, my ‘workaround’ still appears to be fine, three weeks and counting.