Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two Step authentication and authorized devices #52

Closed
manuelbarbosa opened this issue Apr 16, 2022 · 24 comments
Closed

Two Step authentication and authorized devices #52

manuelbarbosa opened this issue Apr 16, 2022 · 24 comments

Comments

@manuelbarbosa
Copy link

Portugal just enabled two factor authentication by SMS and authorized devices. I get Unauthorized error message when trying to login through the API

@sh4rks
Copy link

sh4rks commented May 14, 2022

+1. Same in France, the integration don’t setup because it takes more than 60s

@guerrerotook
Copy link
Owner

The home assistant integration identify as a web app and not as a mobile app. I do have the second factor of authentication on my phone but not on the HA. What happen during the login process?

@manuelbarbosa
Copy link
Author

I will check the error log message and post it here

@greko95
Copy link

greko95 commented Jun 22, 2022

@guerrerotook @manuelbarbosa
Same issue, 2FA is enabled both on web and mobile (France).

This is the error log :

Logger: custom_components.securitas.securitas_direct_new_api.apimanager
Source: custom_components/securitas/securitas_direct_new_api/apimanager.py:106
Integration: Securitas Direct (documentation, issues)
First occurred: 09:39:14 (2 occurrences)
Last logged: 09:59:03

Unauthorized

@guerrerotook
Copy link
Owner

Thanks for the report, unfortunately until this happens to me, it's very difficult to debug remotely. Sorry for the inconvenience.

@siom7
Copy link

siom7 commented Jun 22, 2022

@guerrerotook If needed to debug remotely you can ask to me to do some tests :)

@guerrerotook
Copy link
Owner

@guerrerotook Luis Guerrero Guirado FTE If needed to debug remotely you can ask to me to do some tests :)

That would be awesome @siom7, I have these two documents that explain how to capture requests from the web application.

https://github.com/guerrerotook/securitas-direct-new-api/blob/main/docs/how_to_capture.md

https://github.com/guerrerotook/securitas-direct-new-api/blob/main/docs/new_operations.md

So, I would like you to fully login onto the website and export the request and the responses from the web app. My only request is to be extremely careful because that may contain your login and password and I don't want that information to be leaked . But you have the full end to end flow of the login with the SMS I can try to implement this.

@siom7
Copy link

siom7 commented Jun 23, 2022

Hi @guerrerotook ,

I captured this just after authentication, this can help you ?

{
    "data":
    {
        "xSLoginToken":
        {
            "res":"OK",
            "msg":"Utilisateur correctement validé",
            "hash":"eyJhbGciOiJIUzI1NiJ9.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "lang":"FR",
            "legals":true,
            "mainUser":false,
            "changePassword":false,
            "needDeviceAuthorization":null
        }
    }
}

@siom7
Copy link

siom7 commented Jun 23, 2022

@guerrerotook And this when I check alarm status

{
    "data":
    {
        "xSCheckAlarmStatus":
        {
            "res":"WAIT",
            "msg":"Demande en cours de traitement",
            "status":null,
            "numinst":null,
            "protomResponse":null,
            "protomResponseDate":null
        }
    }
}


{
    "data":
    {
        "xSCheckAlarmStatus":
        {
            "res":"OK",
            "msg":"Votre alarme est désactivée",
            "status":"0","numinst":"XXXXXXXX",
            "protomResponse":"D",
            "protomResponseDate":"2022-06-23 12:44:29.783"
        }
    }
}

@guerrerotook
Copy link
Owner

Thanks very much. It happens to me as well, so now I can easily debug the two steps authentication.

@siom7
Copy link

siom7 commented Jun 23, 2022

Ok, let me know if you need me for some tests :)

@TheGui01
Copy link
Contributor

TheGui01 commented Jun 24, 2022 via email

@sh4rks
Copy link

sh4rks commented Jun 24, 2022

Hello,

the same. Just modify the parameter timedelta (to refresh every 5min) , save and reboot HA. The integration works again.

@guerrerotook
Copy link
Owner

o refresh every 5m

Can you share what you did so I can modify the component and everyone can benefit?

@sh4rks
Copy link

sh4rks commented Jun 24, 2022

I modify the line 45 in alarm_control_panel.py with SCAN_INTERVAL = timedelta(seconds=300)

@manuelbarbosa
Copy link
Author

manuelbarbosa commented Jun 24, 2022

I modify the line 45 in alarm_control_panel.py with SCAN_INTERVAL = timedelta(seconds=300)

How does changing the scan interval fix a 2FA auth on this service!? I am confused...

@siom7
Copy link

siom7 commented Jun 24, 2022

@manuelbarbosa I’m confused like you but I tried the tip of @sh4rks and it’s working 😅

@sh4rks
Copy link

sh4rks commented Jul 7, 2022

Hi @guerrerotook ,

have you find the root cause?

@siom7
Copy link

siom7 commented Jul 24, 2022

@oborqueg Please see this issue -> #57

You just have to wait…

@oborqueg
Copy link

oborqueg commented Jul 24, 2022

@siom7 to wait for what? updated version?
I have the V1.3.0.0 and have the unathorized error :(

@siom7
Copy link

siom7 commented Jul 24, 2022

@oborqueg There is 2FA now to authenticate on Verisure API @guerrerotook is currently working on it, this is why you have Unauthorized error message.

@otistarda
Copy link

Still not working?

@BertMart71
Copy link

I just installed the integration, and same error.

[custom_components.securitas.securitas_direct_new_api.apimanager] Unauthorized

Not working for me: line 45 in alarm_control_panel.py with SCAN_INTERVAL = timedelta(seconds=300)

Any update?

@siom7
Copy link

siom7 commented Sep 2, 2022

@BertMart71 #57

@guerrerotook guerrerotook unpinned this issue Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants