node-blink-security icon indicating copy to clipboard operation
node-blink-security copied to clipboard

An app update is required - failed verification

Open yphoenix opened this issue 4 years ago • 25 comments

Happened to me overnight. Seems Blink changed the API (again)

**[Blink System] Error authenticating with blink API Error: Authentication problem: An app update is required((

    at Request.request.post [as _callback] (/opt/node/lib/node_modules/homebridge-blinkcameras/node_modules/node-blink-security/lib/blink.js:396:25)
    at Request.self.callback (/opt/node/lib/node_modules/homebridge-blinkcameras/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/opt/node/lib/node_modules/homebridge-blinkcameras/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (/opt/node/lib/node_modules/homebridge-blinkcameras/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js```

yphoenix avatar Aug 02 '20 04:08 yphoenix

Same here I’m now getting the same error

Darren5233 avatar Aug 02 '20 07:08 Darren5233

https://github.com/MattTW/BlinkMonitorProtocol/commit/99a27109e6c06a37cd36422ebad766febaa4496a

Looks like MattTW has documented that the URL has changed?

bartdorsey avatar Aug 02 '20 07:08 bartdorsey

Looks like the region information in the response to the authenentication has changed and is now:

{ 
    account: { ... },
    client: { ... },
    authtoken: { ... }
    region: 
    { 
        tier: 'prod', 
        description: 'United States', 
        code: 'us' 
    },
    ...
}

I hacked blink.js (around line 450) to get something that works and we'll see how that goes. So far I can get the list of networks but can't get past that stage as they have probably changed too much other stuff.

yphoenix avatar Aug 02 '20 17:08 yphoenix

Even if you can get past authentication...

https://rest-prod.immedia-semi.com/network/nnn/homescreen

Gives you an app upgrade required response.

yphoenix avatar Aug 02 '20 17:08 yphoenix

I found some of the api source code here to be useful while hacking last night. i think maybe the URL for getSummary() needs to drop the "/homescreen" and simply reference this.urls.network_url + networkId. But then the response parser needs to be updated as well. Once authenticated, i had success receiving system state with https://rest-prod.immedia-semi.com/api/v3/accounts/{blink.account_id}/homescreen but again, the parser in getSummary() expects a different format and would need to be changed. i didn't take the time to try and rewrite the parser.

brianhackel avatar Aug 02 '20 18:08 brianhackel

I don't own the system anymore. Will gladly make someone else a maintainer.

madshall avatar Aug 02 '20 18:08 madshall

If I have time I can look to see if I can fix the code. I wish Blink (AKA: Amazon) would stop doing this, or at least just publish the specs because they know they are going to be easily reverse engineered anyway.

yphoenix avatar Aug 02 '20 19:08 yphoenix

Well many hours later I have some stuff working, but I can't arm a sync module because they have changed the api endpoints again. I'm giving up for today.

yphoenix avatar Aug 03 '20 01:08 yphoenix

Gonna take a stab at refreshing the API doc later today. In lieu of that:

arm/disarm: https://rest-prod.immedia-semi.com/api/v1/accounts/{accountID}/networks/{networkID}/state/arm ordisarm

Command status endpoint URL format does not appear changed at this time.

If there are other endpoint URL's I can grab quick for anyone, let me know.

MattTW avatar Aug 03 '20 14:08 MattTW

Can confirm that that arm / disarm End-point still works.

yphoenix avatar Aug 03 '20 14:08 yphoenix

Currently I don’t have the enable / disable of activity triggers on a camera by camera basis working but have everything else. If I can get that to work I’ll clean it up and submit a set of changes for somebody to review.

yphoenix avatar Aug 03 '20 14:08 yphoenix

you guys are absolute legends, please let us all know once you have this fixed.

Ryanlion79 avatar Aug 14 '20 20:08 Ryanlion79

@yphoenix If you want to share a patch of your current status, perhaps others can help finalize it?

crowston avatar Aug 18 '20 18:08 crowston

Is anyone able to confirm if this is still being worked on?

rcoletti116 avatar Aug 24 '20 13:08 rcoletti116

I can update what I have, it's a hack and it only half works but it is enough to turn on / off my system from HomeKit / Siri which is what I wanted.

yphoenix avatar Aug 27 '20 00:08 yphoenix

Based on the files I changed and the ample console.log's as I debugged these are the files I changed...

homebridge-blinkcameras changes.zip

yphoenix avatar Aug 27 '20 01:08 yphoenix

Yes, this worked! The logging is a bit out of control though. Are you also seeing all of the API responses in your HB logs?

rcoletti116 avatar Aug 27 '20 14:08 rcoletti116

I can update what I have, it's a hack and it only half works but it is enough to turn on / off my system from HomeKit / Siri which is what I wanted.

Can you say which "half" doesn't work? I've got your update running and not seeing any deficiencies yet, other than the logging.

rcoletti116 avatar Aug 27 '20 15:08 rcoletti116

Often I see the status of the system in Home as off when I know full well it is on. There was something else but I’ve forgotten what that was now. The logging is easy to turn off and I purposely didn’t indent the console.log calls to make them easy to find. Once I had something working I stopped and clean everything up and it really needed fixing correctly and I don’t have the time.

yphoenix avatar Aug 27 '20 15:08 yphoenix

I see the first issue now. This occurred in previous versions as well. You turn it on in Home but it will show as off not too long after. Thanks again for sharing your work.

rcoletti116 avatar Aug 27 '20 16:08 rcoletti116

@madshall @rcoletti116 @yphoenix Will there be PR for the current fix?

fklement avatar Oct 18 '20 09:10 fklement

I seem to have figured out what the issue is.

First of all, you need 2FA to make it work. Seems like that's mandatory now, at least for API calls.

Second, the 2FA URL is statically set at 'rest-prod.immedia-semi.com' whereas to verify the PIN it needs to go to a region-specific URL like 'rest-u001.immedia-semi.com'. The script does use that after authentication, but not for the PIN verification request.

~~If I have time this week I'll see if I can make it work and create a PR. So far I've been doing REST API calls from Insomnia to see what's what.~~

mpkossen avatar Oct 19 '20 12:10 mpkossen

I've been digging deeper into this and there have been some substantial changes to the API, meaning parts of this will have to be rewritten. Certain API calls have been deprecated and others have had their response (heavily) altered, meaning anything might work or be broken.

Time permitting I'll work through the script to see what I can do. I'll be submitting pull requests for those changes that I will be able to make successfully, like 2FA, which is mandatory and now works - as long as there's a way to input the PIN.

Blink is definitely not making this easy for third-party developers.

@yphoenix I've been looking at your changes and it seems they have been made before the API changed documented here: https://github.com/MattTW/BlinkMonitorProtocol/commit/a999b0fca3b051e47823f66e63a5715b3a26da80. Listing of networks and sync modules do no longer work and this script seems to rely on them.

mpkossen avatar Oct 19 '20 20:10 mpkossen

@madshall I've gone through the code and updated to the latest API changes thanks to the info on @MattTW page. They are substantial as @mpkossen indicates. Happy to share if anyone is interested.

Pull request here: https://github.com/madshall/node-blink-security/pull/60

djboulia avatar Nov 24 '20 18:11 djboulia

Hi folks, ended up here after a big search on nodejs and blink, is there any plans to fork and proceed or is everyone waiting here for the merges? @djboulia did you ever get this working in your own forks? TIA

spydmobile avatar Mar 07 '23 16:03 spydmobile