From 76ad4cfc14cbaefa612ab89fb8769f3145003792 Mon Sep 17 00:00:00 2001 From: KL4RKS <2390741+KL4RKS@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:51:21 +0000 Subject: [PATCH] Add support for Multi-Factor Authentication Every Sign In setting --- personalcapital/personalcapital.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/personalcapital/personalcapital.py b/personalcapital/personalcapital.py index 52f66df..3388994 100644 --- a/personalcapital/personalcapital.py +++ b/personalcapital/personalcapital.py @@ -27,6 +27,7 @@ def getErrorValue(result): class AuthLevelEnum(object): USER_REMEMBERED = "USER_REMEMBERED" + MFA_REQUIRED = "MFA_REQUIRED" class TwoFactorVerificationModeEnum(object): SMS = 0 @@ -60,6 +61,8 @@ def login(self, username, password): result = self.__authenticate_password(password).json() if getSpHeaderValue(result, SUCCESS_KEY) == False: raise LoginFailedException(getErrorValue(result)) + elif getSpHeaderValue(result, AUTH_LEVEL_KEY) == AuthLevelEnum.MFA_REQUIRED: + raise RequireTwoFactorException() else: raise LoginFailedException() @@ -207,4 +210,4 @@ def __authenticate_password(self, passwd): "csrf": self.__csrf } return self.post("/credential/authenticatePassword", data) - \ No newline at end of file +