BlinkMonitorProtocol icon indicating copy to clipboard operation
BlinkMonitorProtocol copied to clipboard

Unable to use the 2FA

Open Bapth-R opened this issue 3 years ago • 8 comments

Hello,

I'm trying to use the 2FA authentication to be able to access to my Blink camera. Unfortunately, even if the login requests work (POST /api/v5/account/login), I'm not able to finalise the authentication. I explain myself : After this request, I'm receiving a SMS with the code but when I ran the curl command : curl --request POST \ --url https://rest-prod.immedia-semi.com/api/v4/account/111111/client/222222/pin/verify \ --header 'content-type: application/json' \ --header 'token-auth: {TOKENTOKEN}' \ --data '{"pin":"111111"}'

I've got this error message : {"message":"Unauthorized Access","code":101}

Do you have an idea to resolve this problem ?

Thanks :)

Bapth-R avatar Oct 30 '22 23:10 Bapth-R

I'm having the same problem. When looking at the blinkpy repo, I notice they're using TOKEN_AUTH with an underscore instead of a dash, but even that doesn't work for me. I tried sending the pin as an integer instead of a json string and that fails as well.

AMP3D avatar Dec 13 '22 20:12 AMP3D

It works for me. Perhaps the quotes around the pin number are the problem?

JasonBSteele avatar Dec 20 '22 21:12 JasonBSteele

It works for me. Perhaps the quotes around the pin number are the problem?

Would you mind pasting in your method (with the pin and token omitted of course)? That would help us narrow down what we're doing wrong.

In my case I tried without the quotes as well and same issue. I'm using Postman, but here's what the CURL version looks like when exported:

curl --location --request POST 'https://rest-prod.immedia-semi.com/api/v4/account/12345/client/67890/pin/verify' 
--header 'token-auth: 123456789'
--header 'Content-Type: application/json' 
--data-raw '{
    "pin": 123456789
}'

AMP3D avatar Dec 20 '22 21:12 AMP3D

I'm using Postman too, but this is the exported curl

curl --location --request POST 'https://rest-e002.immedia-semi.com/api/v4/account/11111/client/22222/pin/verify'
--header 'token-auth: xxxxxxxxxxxxxxxxx'
--header 'Content-Type: application/json'
--data-raw '{ "pin": 1111111 }'

Looks like it could be the URL. You need to use the tier returned from the initial login.

JasonBSteele avatar Dec 20 '22 22:12 JasonBSteele

Ah the URL was the issue, thanks @JasonBSteele !

AMP3D avatar Dec 20 '22 22:12 AMP3D

Thanks a lot @JasonBSteele

For those using Postman:

Login

GET https://rest-prod.immedia-semi.com/api/v5/account/login

Body (raw->json):

{
    "email" : "<your email>",
    "password" : "<your PW>"
}

Tests:

var jsonData = JSON.parse(responseBody);
pm.environment.set("accountId", jsonData["account"]["account_id"]);
pm.environment.set("clientId", jsonData["account"]["client_id"]);
pm.environment.set("userId", jsonData["account"]["user_id"]);
pm.environment.set("access_token", jsonData["auth"]["token"]);
pm.environment.set("tier", jsonData["account"]["tier"]);

Verify PIN

POSThttps://rest-{{tier}}.immedia-semi.com/api/v4/account/{{accountId}}/client/{{clientId}}/pin/verify

Body (raw->json):

{"pin": <your pin>}

Header:

Content-type: application/json
token-auth: {{access_token}}

agavrel avatar Dec 25 '22 06:12 agavrel

@JasonBSteele would you mind sharing your request for liveview? Mine is not working

agavrel avatar Dec 26 '22 22:12 agavrel

Thanks a lot @JasonBSteele

For those using Postman:

Login

GET https://rest-prod.immedia-semi.com/api/v5/account/login

Body (raw->json):

{
    "email" : "<your email>",
    "password" : "<your PW>"
}

Tests:

var jsonData = JSON.parse(responseBody);
pm.environment.set("accountId", jsonData["account"]["account_id"]);
pm.environment.set("clientId", jsonData["account"]["client_id"]);
pm.environment.set("userId", jsonData["account"]["user_id"]);
pm.environment.set("access_token", jsonData["auth"]["token"]);
pm.environment.set("tier", jsonData["account"]["tier"]);

Verify PIN

POSThttps://rest-{{tier}}.immedia-semi.com/api/v4/account/{{accountId}}/client/{{clientId}}/pin/verify

Body (raw->json):

{"pin": <your pin>}

Header:

Content-type: application/json
token-auth: {{access_token}}

The login is not a GET. Its a POST.

clipod avatar Jan 30 '24 04:01 clipod