MattTW / BlinkMonitorProtocol

Unofficial documentation for the Blink Wire-Free HD Home Monitoring & Alert System
412 stars 77 forks source link

POST /api/v4/account/{AccountID}/client/{ClientID}/pin/verify -> (401. Unauthorized) #54

Closed Zeroflag01 closed 2 years ago

Zeroflag01 commented 3 years ago

Hello everyone, I have been trying to write a small .NET programme for a few days now. Actually, I just want to display the current Kamara picture on a Windows PC.

The login works as far as it goes. I get account ID, token etc. back:


  "account": {
    "account_id": xxxxx,
    "user_id": xxxxx,
    "client_id": xxxxx,
    "new_account": false,
    "tier": "e003",
    "region": "eu",
    "account_verification_required": false,
    "phone_verification_required": false,
    "client_verification_required": true,
    "verification_channel": "email"
  },
  }, "auth": {
    }, "token": "xxxxxxxxxxxxxxx"
  },
  "phone": {
    }, "number": "+",
    "last_4_digits": "",
    "country_calling_code": "",
    "valid": false
  },
  }, "verification": {
    }, "email": {
      "required": true
    },
    }, { "phone": {
      "required": false,
      }, "channel": "sms"
    }
  },
  "lockout_time_remaining": 0,
  "force_password_reset": false,
  "allow_pin_resend_seconds": 60
}

I also receive an e-mail with a PIN. OK. What surprises me is that "Device" and "Device Name" are both empty in the email! Can I enter them somehow when I log in?

Then I try to pass the PIN with the current token:

For example, like this:


Dim baseUrl as String = "https://rest-prod.immedia-semi.com"
Dim uri As String = baseUrl & "/api/v4/account/" & m_AccountID & "/client/" & m_ClientID & "/pin/verify"

Dim client = New WebClient()
client.Headers.Add("Content-Type:application/json")
client.Headers.Add("token-auth:xxxxxxxxxxxxxx")

Dim pinVerifyData As New PinVerify With {
        .pin = pin
    }

Dim pinVerifyDataJson As String = JsonConvert.SerializeObject(pinVerifyData)

Try
    Dim response = client.UploadString($"{uri}", pinVerifyDataJson)
    Return response

Catch ex As Exception
    m_ErrorMessage = ex.Message
    Return ""

End Try

I have already tried countless variations...

But I always get a 401 back.

Does anyone have any idea what I am doing wrong?

Thanks a lot!!!

Zeroflag01 commented 3 years ago

What a pity, no one answers... :-(

What I have found out in the meantime is that there are other (optional) parameters for the "login":

If you specify "client_name" and "device_identifier", for example, this data will also appear in the e-mail.

However, none of this solves my problem... Verify Pin simply does not work (anymore?).

I have tried everything I could think of... Send "unique_id" along etc...

Could this be due to the structure of the header?

I've tried just about everything there too (you can find just about any variation on Google :(( ):

I'm running out of ideas....

Zeroflag01 commented 3 years ago

SORRY ! i was just too stupid to put "tier" into the url... I always had "region" in it... :-((( Now it works! ;-))

arnaduga commented 3 years ago

I'm facing similar issue. What was your mistake? What is the baseURL you finally used to get it work?

Thnx

arnaduga commented 3 years ago

Got it, as explained in https://github.com/MattTW/BlinkMonitorProtocol/issues/57