-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Description
In coned.py when MFA is enabled we raise an error if there is no TOTP code set up. Setting up TOTP is a pretty big barrier to entry for most people. It's much more common to have SMS set up. It's easy enough to make SMS codes work in a hacky way like so:
mfaCode = TOTP(optional_mfa_secret.strip()).now()
mfaCode = input('📲 Enter the 2FA code: ').strip()
A better way might be to do something like this:
@classmethod
async def async_login(
cls,
session: aiohttp.ClientSession,
username: str,
password: str,
optional_mfa_secret: Optional[str],
optional_mfa_code_retriever: Optional[Callable[[], Awaitable[str]]]
) -> str:
...
if not result["noMfa"]:
if optional_mfa_secret:
mfaCode = TOTP(optional_mfa_secret.strip()).now()
elif optional_mfa_code_retriever:
mfaCode = await optional_mfa_code_retriever()
else:
raise InvalidAuth(
"TOTP secret or code retriever is required for MFA accounts"
)
What do you think?
icedmatchawhip and skortchmark9
Metadata
Metadata
Assignees
Labels
No labels