chrisjshull / homebridge-nest

Nest plugin for HomeBridge
700 stars 112 forks source link

Can't authenticate to Google Nest using refreshToken #536

Closed vmcilwain closed 2 years ago

vmcilwain commented 2 years ago

node --version v16.13.1

homebridge --version 1.4.0

homebridge-nest v4.6.6

I am attempting to authenticate homebridge-nest from my homebridge running on my raspberry pi.

I am getting the following in the log file:

[Nest] Access token acquisition via googleAuth failed [code 400].
[Nest] unable to authenticate with Goggle/Nest.
[Nest] NOTE: Because we couldn't connect to the Nest service, your Nest devices in HomeKit will not be responsive.

I ran login.js from inside the plugin directory and pasted the refreshToken via the terminal but it didn't seem to take.

I then decided to run login.js again and copy the refreshToken into the settings UI but that also didn't seem to work. In both cases, I was getting either bad request or malformed token.

To get past this, I ended up running login.js again and then copying the refreshToken directly into the json config.

adriancable commented 2 years ago

If you get an error like this, it means you’re copying and pasting the token displayed by login.js wrong. Usually you have extra spaces before or after the token, or a new line, that shouldn’t be there. Without seeing the config.json when things didn’t work I can’t tell you what you did wrong of course, but this isn’t a plug-in issue.

vmcilwain commented 2 years ago

Yeah I was trying to get a copy of the config but I didn’t have an easy way to do that at the moment.

‘login.js’ never displayed a token to me. I copy and pasted the url it displayed abs when I got the token and pasted it in the terminal, ‘login.js’ just exits without any confirmation. When I check the config the refreshToken is empty.

I will try to get a config posted if it helps otherwise I will keep trying trying.

adriancable commented 2 years ago

@vmcilwain - the tool doesn’t write into config.json - you’ll need to do that.

It shouldn’t just exit after you paste the code - it should print another code which you put into config.json (or enter into the UI). If that’s not happening, then post a screenshot of what you see. (Redact part of the code when you post.)

vmcilwain commented 2 years ago

Thanks for the additional insight. I randomly had to reboot my raspberry pi and ran through the process again and it worked without issue. I saw the token that needed to be copied into homebridge-nest and was able to authenticate without issue.

Thanks for taking the time to help me through this.

kylewhirl commented 2 years ago

I’m having this problem as well but my refresh token does not have any spaces or new lines. It was working before, but then my Homebridge instance restarted and it stopped working