colinbendell / homebridge-blink-for-home

Blink For Home Camera Homebridge plugin
MIT License
88 stars 27 forks source link

Is this an invalid 2FA or a different problem? #64

Closed mtressl closed 2 years ago

mtressl commented 3 years ago

With a Homebridge restart yesterday, I started to see this error in the start-up process:

[3/30/2021, 3:19:46 PM] [Blink Security] GET /api/v3/accounts/67210/homescreen (401 Unauthorized)

[3/30/2021, 3:19:46 PM] [Blink Security] { 'client-verified': '0', 'content-length': '44', 'content-type': 'application/json', date: 'Tue, 30 Mar 2021 13:19:45 GMT', server: 'nginx + Phusion Passenger', status: '401 Unauthorized', via: '1.1 baa5702f7bd64fcbae1e3bd950d9a245.cloudfront.net (CloudFront)', 'x-amz-cf-id': 'dAjSPWdqP2wJnmhP8_25Soj8NUVWW46I1_ggjtBg_9v0HV3fU7Ed4g==', 'x-amz-cf-pop': 'FRA6-C1', 'x-blink-served-by': 'i-0cc1f85ca9e85451b', 'x-cache': 'Error from cloudfront', 'x-content-type-options': 'nosniff', 'x-powered-by': 'Phusion Passenger' }

[3/30/2021, 3:19:46 PM] [Blink Security] Error: 401 Unauthorized at BlinkAPI._request (/homebridge/node_modules/homebridge-blink-for-home/src/blink-api.js:167:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at BlinkAPI._request (/homebridge/node_modules/homebridge-blink-for-home/src/blink-api.js:160:24) at BlinkAPI.get (/homebridge/node_modules/homebridge-blink-for-home/src/blink-api.js:82:16) at BlinkAPI.getAccountHomescreen (/homebridge/node_modules/homebridge-blink-for-home/src/blink-api.js:526:16) at Blink.refreshData (/homebridge/node_modules/homebridge-blink-for-home/src/blink.js:730:28) at HomebridgeBlink.setupBlink (/homebridge/node_modules/homebridge-blink-for-home/src/index.js:111:13) at HomebridgeBlink.init (/homebridge/node_modules/homebridge-blink-for-home/src/index.js:48:26)

[3/30/2021, 3:19:46 PM] [Blink Security] Error: Unable to authenticate with Blink. Missing 2FA PIN? at HomebridgeBlink.setupBlink (/homebridge/node_modules/homebridge-blink-for-home/src/index.js:117:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at HomebridgeBlink.init (/homebridge/node_modules/homebridge-blink-for-home/src/index.js:48:26)

[3/30/2021, 3:19:46 PM] [Blink Security] NOTE: Blink devices in HomeKit will not be responsive.

AkimoA commented 3 years ago

Login into the blink app on your phone and update and accept their policy ( you need to provide a phone number ) and u good to go from then on .

Bacardi75 commented 3 years ago

I'm having the same issue than mtressl. I tried AkimA solution, but it didn't work in my case. Any other options?

michbeck100 commented 3 years ago

I think I have the same problem. When I first start the plugin I get the 401 error but then no 2FA Code is send to my mobile phone. Maybe its not working because blink is sending an SMS?

danielballance commented 3 years ago

Joining in to report I'm having the same problem. No MFA email, etc., received. Tried signing out of the Blink iOS app and then signing in to force a MFA SMS code and giving that to the plugin, but didn't work (not surprising, but thought worth a try). No change in indications with the MFA SMS code.

xImportExportx commented 3 years ago

@danielballance Blink doesn't do 2FA via Email any more from what I've seen. Its SMS only. Have you restarted home bridge after putting the details in. Just simply applying the config won't sign you in, you have to restart home bridge to get the 2fa token then input it and restart again.

danielballance commented 3 years ago

@xImportExportx thanks for reaching out. I wasn't seeing changes after restarting HomeBridge and the underlying Ubuntu VM. However, it is now working -- re-entering the password now has it performing as expected. Did not receive an SMS code, but it appears to be up. Unsure why re-entering the password fixed it, password had been verified as correct. Regardless, it's now working, so I withdraw. Thanks!

Kragothius commented 2 years ago

Maxie you should turn on Debug Logging Mode. If there are to many Login Attempts cause of restarts of Homebridge your account will be blocked for about 60 Minutes.

Search the Log for

{"message":"Login limit exceeded. Please disable any 3rd party automation and try again in 60 minutes.","lockout_time_remaining":0,"force_password_reset":false,"allow_pin_resend_seconds":90,"code":106}

acidcrinkle commented 2 years ago

I'm having an issue getting the blink plugin to generate a 2FA code and login, I've included the debug log below hopefully someone can point me in the right direction as to what's wrong. I've setup a brand new NUC running Ubuntu and installed a new instance of HomeBridge to test this out, it was running on a Pi Zero and has been working fine for months but a few days ago it errored and I've not been able to get it to log in again. I can log in and out of the app on my phone no problem, if I try and use a 2FA code generated from a phone login it still doesn't work.

Any ideas?

[14/03/2022, 19:49:30] [Blink] Launched child bridge with PID 9031
[14/03/2022, 19:49:31] Registering platform 'homebridge-blink-for-home.Blink'
[14/03/2022, 19:49:31] [Blink] Loaded homebridge-blink-for-home v3.7.6 child bridge successfully
[14/03/2022, 19:49:31] [Blink] Init Blink
[14/03/2022, 19:49:31] [Blink] {
  method: 'POST',
  headers: {
    'User-Agent': 'Blink/12379 CFNetwork/1327.0.4 Darwin/21.2.0',
    'app-build': 'IOS_12379',
    Locale: 'en_US',
    'x-blink-time-zone': 'America/New York',
    'accept-language': 'en_US',
    Accept: '*/*',
    'Content-Type': 'application/json'
  },
  body: '{"app_version":"6.1.1 (8854) #e06341d7f","client_name":"unknown","client_type":"ios","device_identifier":"iPhone12,3","email":"xxxxxx@gmail.com","notification_key":"xxxxxxxxx","os_version":"14.5","password":"xxxxxxxx","reauth":"true","unique_id":"xxxxxxxx"}'
}
[14/03/2022, 19:49:31] Homebridge v1.4.0 (HAP v0.10.0) (Blink) is running on port 55437.
[14/03/2022, 19:49:32] [Blink] 401 
[14/03/2022, 19:49:32] [Blink] {
  'client-verified': '0',
  'content-length': '150',
  'content-type': 'application/json',
  date: 'Mon, 14 Mar 2022 19:49:32 GMT',
  server: 'nginx + Phusion Passenger',
  status: '401 Unauthorized',
  via: '1.1 5f0e68f33526ad0b79de5ce0fc54f62a.cloudfront.net (CloudFront)',
  'x-amz-cf-id': '4lmGt4cggX6MbnVU0SBbmA56gN6rs68AwApyZ4srXMtWiwiVnQas8g==',
  'x-amz-cf-pop': 'LHR61-P3',
  'x-blink-served-by': 'i-01dc7430356bd3855',
  'x-cache': 'Error from cloudfront',
  'x-content-type-options': 'nosniff',
  'x-powered-by': 'Phusion Passenger'
}
[14/03/2022, 19:49:32] [Blink] {"message":"Client already deleted. Please re-login","lockout_time_remaining":0,"force_password_reset":false,"allow_pin_resend_seconds":90,"code":242}
[14/03/2022, 19:49:32] [Blink] POST /api/v5/account/login (401 Unauthorized)
[14/03/2022, 19:49:32] [Blink] {
  'client-verified': '0',
  'content-length': '150',
  'content-type': 'application/json',
  date: 'Mon, 14 Mar 2022 19:49:32 GMT',
  server: 'nginx + Phusion Passenger',
  status: '401 Unauthorized',
  via: '1.1 5f0e68f33526ad0b79de5ce0fc54f62a.cloudfront.net (CloudFront)',
  'x-amz-cf-id': '4lmGt4cggX6MbnVU0SBbmA56gN6rs68AwApyZ4srXMtWiwiVnQas8g==',
  'x-amz-cf-pop': 'LHR61-P3',
  'x-blink-served-by': 'i-01dc7430356bd3855',
  'x-cache': 'Error from cloudfront',
  'x-content-type-options': 'nosniff',
  'x-powered-by': 'Phusion Passenger'
}
[14/03/2022, 19:49:32] [Blink] Error: 401 Unauthorized
    at BlinkAPI._request (/usr/lib/node_modules/homebridge-blink-for-home/src/blink-api.js:167:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at BlinkAPI.login (/usr/lib/node_modules/homebridge-blink-for-home/src/blink-api.js:309:21)
    at HomebridgeBlink.setupBlink (/usr/lib/node_modules/homebridge-blink-for-home/src/index.js:110:13)
    at HomebridgeBlink.init (/usr/lib/node_modules/homebridge-blink-for-home/src/index.js:48:26)
[14/03/2022, 19:49:32] [Blink] Error: Unable to authenticate with Blink. Missing 2FA PIN?
    at HomebridgeBlink.setupBlink (/usr/lib/node_modules/homebridge-blink-for-home/src/index.js:117:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HomebridgeBlink.init (/usr/lib/node_modules/homebridge-blink-for-home/src/index.js:48:26)
[14/03/2022, 19:49:32] [Blink] NOTE: Blink devices in HomeKit will not be responsive.
Anqui3tas commented 2 years ago

I have the same issue, I can't get it to push a 2FA request, I enter a number 123456 and that stops the 401 unauthorized error, but then I receive an invalid 2FA code (expected)

is there a command to trigger the below, (require new pin) or set to True?

[Blink] { valid: false, require_new_pin: false, code: 1621, message: 'Invalid PIN' }

xImportExportx commented 2 years ago

@acidcrinkle and @Anqui3tas what I found when I had issue's was that other applications were also triggering the 2fa and there is some sort of rate limit Blink's implementing sending the 2fa SMS messages.

I'd do this.

  1. Log out and Back in on your mobile app (this is what led me to originally fix my issues. The error on the app told me I had to wait some time due to repetitive failed logins).
  2. Disable all Blink integrated plugins you have running, I had home-assistant running as well so disabled. Make sure nothing is trying to use the blink API. I even logged out the app on my phone for troubleshooting just to be sure. Disable the home bridge plugin as well.
  3. Leave it 30mins+ with all plugins and extensions disabled.
  4. Remove the 2fa code in your home bridge configuration, enable the plugin and restart. Make sure your username and password are 100% correct at this point as if this is incorrect you will get a unauthorized regardless.
  5. If you left enough time the 2fa code should come through to your mobile device.
  6. Input 2fa code in home bridge configuration
  7. Restart home bridge

Eh Voilla you should have the plugin working. Let me know if this helps :)

NB: In my case because of various different plugins interacting with the API I actually had to wait 60mins+ for this to be effective, this is especially the case if you were getting your user/pass wrong.

acidcrinkle commented 2 years ago

@xImportExportx Thanks for the tips, I've gone through the steps and I still cannot get HomeBridge to work. Definitely not getting the credentials wrong, copy/paste from password manager.

Interestingly, I found the 'Manage Devices' in the account section of the Blink app on my iPhone, I've not noticed this before! It requires a 2FA code to get into it which is sent when you try to enter. This had Home Assistant and Alexa listed along with my iPhone and iPad but not the HomeBridge plugin.

I have removed all the devices listed and logged my iPhone app out. For good measure I also removed the HA plugin and the Alexa skill. I left it a good hour before trying the HB plugin again and nothing, still the same error and no 2FA code sent.

I've logged my iPhone, iPad, Home Assistant and Alexa back in no problems, all generated 2FA codes as I'd expect.

colinbendell commented 2 years ago

@xImportExportx thanks for the insight. I'll see if I can add some back out process to help with these situations. I've discovered there is also an additional api set for requesting a new pin. I'll see how I can incorporate that

colinbendell commented 2 years ago

I've added new logic to handle these 2fa cases and added re-request pin logic. see commit 3b7355a

The main branch is ready for testing if anyone is interested

jasonross141727 commented 2 years ago

Would love to test, not sure how. I have Blink not sending me a text message with a pin. I have never received an email for the 2FA. When i sign into the platform it always sends me a text with a code. Blink plugin worked great prior but stopped and now cannot get it to work as the 2FA not getting a text. I would test in anyway I can.

acidcrinkle commented 2 years ago

@colinbendell I'm also more than happy to test but I have no idea how I'd go about that, is there a special build I can install via the terminal?

Anqui3tas commented 2 years ago

@colinbendell I'm also more than happy to test but I have no idea how I'd go about that, is there a special build I can install via the terminal?

I would do the same. I have the newer versions as well as v1 of the cameras and hub.

Anqui3tas commented 2 years ago

the new update (3.9.0) resolved my 2FA issue (at least for me)

acidcrinkle commented 2 years ago

3.9.0 has resolved for me too, thanks!

jasonross141727 commented 2 years ago

3.9.0 has resolved my issue also. Thank you

colinbendell commented 2 years ago

Great to hear!