Brandawg93 / homebridge-nest-cam

View your Nest cams in HomeKit using Homebridge.
https://www.npmjs.com/package/homebridge-nest-cam
GNU General Public License v3.0
211 stars 27 forks source link

login.js fails with 'Could not generate "googleAuth" object.' #303

Closed demonbane closed 3 years ago

demonbane commented 3 years ago

Running homebridge on a Raspberri Pi, I'm getting a "could not generate googleauth object" error when I try to run login.js. This has been working fine for me for a few months already, but just stopped working today.

I'm running login with homebridge-nest-cam login -p /usr/bin/chromium-browser -h. The entire browser workflow goes as usual with me logging in without a problem. After logging in the browser closes, and my terminal shows the error where I used to get the credentials printed. I've also tried running with node dist/login.js from the module directory and still get the same issue.

Everything is up to date according to Homebridge Config UI X.

Brandawg93 commented 3 years ago

The latest version of the plugin (v5.4.2) should be more descriptive on what went wrong during the login process. Let me know if this helps.

mzaur commented 3 years ago

I have the same issue on windows, and I'm on homebridge-nest-cam v5.5.0. If I try through the UI it says

"Could not generate "googleAuth" object. You can still manually retrieve the issue token and enter it below."

If I try in command prompt it says:

Could not generate "googleAuth" object.

Below are the values retrieved by the login process:

issueToken: undefined, cookies: undefined

I'm not sure what I am doing wrong. I just installed Homebridge today but did follow all the instructions.

The weird thing is that the first time I tried to login through the UI, I did receive an email alert from Google for new device signed in, so it seemed to login just fine. I'll also mention that I'm not using any 2FA

Brandawg93 commented 3 years ago

@mzaur Are you able to get your login credentials using the manual web scraping method? The UI should be doing the exact same thing but it seems to be having issues for some.

mzaur commented 3 years ago

@mzaur Are you able to get your login credentials using the manual web scraping method? The UI should be doing the exact same thing but it seems to be having issues for some.

I tried that with Chrome but it didn't seem to work out. I followed the instructions here and was on step 6. I am not sure what 'iframerpc' call means. But I have two "issue_jwt" under headers, and neither one has a URL beginning with accounts.google.com. Instead the two Request URLs are both https://nestauthproxyservice-pa.googleapis.com/v1/issue_jwt

I did clear all cookies too. Did Google change something?

Brandawg93 commented 3 years ago

That usually means that your browser is holding onto your credentials. Try a new browser or using incognito mode.

mzaur commented 3 years ago

Thanks! I was able to get it. I forgot to click 'preserve log' Do I have to do this every time I re-auth? Do you need any logs or anything to figure out why the normal login method doesn't work?

Brandawg93 commented 3 years ago

I just published v5.5.1 that should fix this issue. If someone has a chance to confirm this works, please let me know.

demonbane commented 3 years ago

Just tested 5.5.1 on the Raspberry Pi and now it is providing the cookies value but not issueToken:

pi@homebridge:~ $ homebridge-nest-cam login -h
Opening chromium browser...
Could not generate "googleAuth" object. 

Below are the values retrieved by the login process:

issueToken: undefined,
cookies: [REDACTED]

Using the manual method as described in the wiki still seems to work ok.

demonbane commented 3 years ago

Just noticed that the automated method returns a lot more data for the cookies than what I get with the manual method. These are the keys that are included from homebridge-nest-cam login -h:

pi@homebridge:~ $ tr ';' '\n' < testlogin | cut -f1 -d'='
user_id
 NID
 SIDCC
 __Host-GAPS
 ACCOUNT_CHOOSER
 __Secure-3PSIDCC
 SSID
 __Secure-3PAPISID
 SMSV
 __Secure-3PSID
 APISID
 LSID
 SAPISID
 SID
 __Host-3PLSID
 HSID

And here's what I get from the manual method:

pi@homebridge:~ $ tr ';' '\n' < testdevtools | cut -f1 -d'='
__Secure-3PSID
 __Host-3PLSID
 __Secure-3PAPISID
 NID
 __Secure-3PSIDCC

Not sure if that's relevant or not, just thought it was worth pointing out.

Brandawg93 commented 3 years ago

@demonbane That's good info. Thanks! Does it work for you without the -h? I was experiencing the same issue when trying it in headful mode.

Brandawg93 commented 3 years ago

I just published a new test version that should fix this issue. You can try it out by installing the latest test version via config-ui or via npm -g i homebridge-nest-cam@5.5.2-test.0 --unsafe-perm. Let me know if this works for you.

demonbane commented 3 years ago

Looks good! Just tried 5.5.2-test (still in headful mode since I'm using 2FA), and it worked without a problem.

Brandawg93 commented 3 years ago

Great to hear! I've published v5.5.2 which includes these changes.