-
Notifications
You must be signed in to change notification settings - Fork 23
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
Requirements and suggestions related to MFA handling #41
Comments
I added support for a custom MFA handler on the custom_mfa branch. Would something like that work? |
This is a different/better approach, I will check if I can get this to work, thanks alot! |
@matin Finally got some time to try get the 'external/custom' mfa to work with example.py (so I can adapt it to this afterwards) But i run into an issue, not sure if I fetched the repo branch correctly, or something is still missing in Login() somewhere. This is the requirements-dev.txt, example.py and adapted garmin_connect package so far: https://github.com/cyberjunky/python-garminconnect/tree/mfa I get this error when running example.py:
|
I'm not sure you're on the right branch. Could you try the following in your requirements-dev.txt?
|
I first needed to remove the old garth package it seems, and then use your url. It works! I has some small bugs to fix, but then I just got my first MFA login from example.py using external MFA input code, this is a breakthrough! |
Released as 0.4.45 |
Great to hear this worked! |
Thanks a lot! |
@matin I run into an issue with the MFA lambda call, I hope it's due to my limited Python knowledge, or brain fog, but i have this:
Where mycall is an async function to get the MFA code https://github.com/home-assistant/core/blob/dev/homeassistant/components/abode/config_flow.py#L136 Any help or pointers are welcome, thanks! |
I'll take a look |
It's because Garth isn't expecting a coroutine as a response. Let me see what I can do. |
@matin Did you manage to investigate/think about a possible solution? |
@cyberjunky sorry this took me so long. I've been busier than usual the last few weeks. I just published 0.4.46.
The change was fairly simple. Let me know if this works for you. |
Btw, if you're looking to use garminconnect as async, it'd be easier to wrap it with asyncer than to rewrite it. |
Hey @matin I just tried to implement this, but with Home Assistant, this is a real struggle, when the MFA request happens in the same call as the initial login. Would it be possible to refactor the login to split it into two seperate calls? Like having the In the home assistant config flow there are tight restrictions on co-routines and background jobs, so this is quite tricky to implement when the initial call has to wait for the input, as we can't just show a new dialog. |
what's the issue with the callback approach? |
When we call the Therefore we can't show a new dialog and ask the user for the MFA, since the username+password dialog is still waiting for the feedback (return) of the So in the HA integration this starts with showing the form and processes the user input afterwards. But since this call can never finish, we can't ask for an MFA code. Also using the |
got it. I'll take a look |
I want to implement -a much needed and requested- MFA functionality to my Home-Assistant integration home-assistant-garmin_connect
Garth handles this perfectly from cli/python-garminconnect's example.py code but for this to work from GUI code I think I need some small changes to or extra methods added to garth to handle MFA.
I think about this approach (by looking at the current code briefly due to time shortage) :
What do you think? If you have suggestions or a better approach (which you often have), please let me know.
The text was updated successfully, but these errors were encountered: