balansse / homebridge-vivint

Integrates Vivint security system with Apple Home
Other
45 stars 15 forks source link

No MFA option in HOOBS #48

Closed 3ne closed 2 years ago

3ne commented 2 years ago

Let me preface by saying thank you so much for maintaining this repo. With the 1.6.0 update there isnt an option to add the username and password to get the token.

Snag_1b8a8951 . You stated "If needed, you can manually generate a refresh token by running "npm run mfa" in the command line", but Im not sure if I should try this.

jgrimard commented 2 years ago

Unfortunately HOOBS doesn't directly support the Custom UI components created for Homebridge. HOOBS would need a sidecar created to support this. There are some examples here: https://github.com/hoobs-org/sidecars As a workaround, you can open a terminal in HOOBS and run the following commands: where "vivintbridge" is the name of the bridge but all lowercase and with no spaces.

cd /var/lib/hoobs/vivintbridge/node_modules/@balansse/homebridge-vivint
npm run mfa

It will ask you to login to vivint and return an refreshToken.
Copy and paste this token into the configuration page, click save, and you should be all set.

3ne commented 2 years ago

@jgrimard thank you for the reply, I will try it and see how it goes before I close this.

3ne commented 2 years ago

Command works and I can enter the credentials but I never receive an MFA code.

jgrimard commented 2 years ago

@3ne does it give any error after entering your credentials? Can you paste the results?

3ne commented 2 years ago

No error, I enter email/password and the next prompt is to enter the MFA but i never receive one via sms or email.

3ne commented 2 years ago

Snag_205d6bfe No error

3ne commented 2 years ago

I noticed if I try to directly login at vivintsky.com I get a 503 service error

jgrimard commented 2 years ago

503 at vivintsky.com is normal. What do you get if you go to this link? https://www.vivintsky.com/api/authuser it should say "{"msg": "Your session has no user information. Please login", "code": 401, "msg_id": null}"

JorgeQntnl commented 2 years ago

Same here… no error but never receive MFA code.

jgrimard commented 2 years ago

I created a separate debug package for the command line interface. In terminal run the following:

npm install -g vivint_mfa_cli_debug
vivint_mfa_cli_debug

This is the same program but will output all of the response data from vivint. Hopefully it will tell us whats going on. After you enter your user name and password it will attempt to log you in at https://www.vivintsky.com/api/login If that works (status code 200), it will try to get your information from https://www.vivintsky.com/api/authuser That request is supposed to either give you a status code 200 if you don't need MFA, or give you a status code 401 and trigger the sending of a MFA authentication code to your email/phone. Try to find and copy the status codes and error messages it is giving in the responses.

JorgeQntnl commented 2 years ago

So after some tinkering around I found a solution that worked for me. Hope this helps...

I disabled 2FA on the Vivint app - menu >users >(admin user) > turn off 2FA.

I then re-enabled 2FA and went through the setup process. Vivint will give you a Setup Key. Copy the code.

Use Google Authenticator app, hit the + sign on the bottom right corner (iOS app) and choose "Enter Setup Key" on "Account" type in Vivint and for "Key" paste the Setup Key you got from the Vivint app.

This will provide you with 2FA codes for Vivint login that refresh every 30 seconds.

After using the command line:

cd /var/lib/hoobs/vivintbridge/node_modules/@balansse/homebridge-vivint npm run mfa

Type in your email and password and when it prompts for the MFA, use the code from the Google Authenticator app. If you do it correctly you will get a refresh token. Copy and paste into configuration page and you should be good to go!

This worked for me. Everything seems to be working fine now. One thing I did notice is you may have to do it on 2 separate devices or 2 browser tabs (I did it on 2 browser tabs - 1 tab for your terminal & 1 tab on the Vivint configuration page) You want to make sure your "terminal" browser tab doesn't time out before you enter the refresh token on the Vivint configuration page or you may have to repeat the steps and try again.

I hope this helps. 👍

3ne commented 2 years ago

503 at vivintsky.com is normal. What do you get if you go to this link? https://www.vivintsky.com/api/authuser it should say "{"msg": "Your session has no user information. Please login", "code": 401, "msg_id": null}"

Yes it does. Snag_2356ef80

3ne commented 2 years ago

I created a separate debug package for the command line interface. In terminal run the following:

npm install -g vivint_mfa_cli_debug
vivint_mfa_cli_debug

This is the same program but will output all of the response data from vivint. Hopefully it will tell us whats going on. After you enter your user name and password it will attempt to log you in at https://www.vivintsky.com/api/login If that works (status code 200), it will try to get your information from https://www.vivintsky.com/api/authuser That request is supposed to either give you a status code 200 if you don't need MFA, or give you a status code 401 and trigger the sending of a MFA authentication code to your email/phone. Try to find and copy the status codes and error messages it is giving in the responses.

Ok will do and report back

jgrimard commented 2 years ago

@3ne Do you have "Two-factor authentication" enabled in the Vivint app? If so, then it won't send you a code via email or text. You will instead use the code from your authenticator app.

3ne commented 2 years ago

@3ne Do you have "Two-factor authentication" enabled in the Vivint app? If so, then it won't send you a code via email or text. You will instead use the code from your authenticator app.

Yes its enabled in the app. I will try the authenticator. Thanks.

3ne commented 2 years ago

@jgrimard Thank you so much for the assistance. That was the key to all this, everything is working now! I will close this issue.

3ne commented 2 years ago

It may be best to mention this process in the instructions for HOOBS users/ folks with 2FA enabled in the Vivint app. I will leave tis open for reference.

jgrimard commented 2 years ago

I have opened an issue in HOOBS here if you want to voice your support. https://github.com/hoobs-org/sidecars/issues/4

jcdelacruz23 commented 2 years ago

Thank you very much for all the information. My vivint accessories is finally on my Homekit App and working!

3ne commented 2 years ago

I have opened an issue in HOOBS here if you want to voice your support. hoobs-org/sidecars#4

Thank you @jgrimard

robbhudson commented 2 years ago

This is SUPER helpful, I'm trying to get through it myself, but I'm super new to this. I would try to summarize all this in one post, with steps for others who found this like I did, but I fear I'll get something wrong (I haven't actually attempted anything yet).

Is the last step after this: 134603732-6df035a8-9cad-4cd3-8af9-5a72c8d69922

to take that long code (mine began with s=) and put it in the Configuration tab/button under Vivint Refresh Token?

and then just wait?

robbhudson commented 2 years ago

This is SUPER helpful, I'm trying to get through it myself, but I'm super new to this. I would try to summarize all this in one post, with steps for others who found this like I did, but I fear I'll get something wrong (I haven't actually attempted anything yet).

Is the last step after this: 134603732-6df035a8-9cad-4cd3-8af9-5a72c8d69922

to take that long code (mine began with s=) and put it in the Configuration tab/button under Vivint Refresh Token?

and then just wait?

Ok, this did work. Thanks everyone.

jgrimard commented 2 years ago

This has been fixed in HOOBS 4.1.13. Please update your HOOBS to the latest version. You might also need to re-install the homebridge-vivint plugin. This issue can be closed.