Skip to content

Commit dabdced

Browse files
authored
Merge pull request #15 from physera/handle-verify-factor-pending
Correctly handle pending responses
2 parents b091347 + 4c334c7 commit dabdced

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/onelogin/api/client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,16 @@ def handle_saml_endpoint_response(self, response):
119119
saml_endpoint_response = None
120120
try:
121121
content = response.json()
122-
if content and 'status' in content and 'data' in content and 'message' in content['status'] and 'type' in content['status']:
122+
if content and 'status' in content and 'message' in content['status'] and 'type' in content['status']:
123123
status_type = content['status']['type']
124124
status_message = content['status']['message']
125125
saml_endpoint_response = SAMLEndpointResponse(status_type, status_message)
126-
if status_message == 'Success':
127-
saml_endpoint_response.saml_response = content['data']
128-
else:
129-
mfa = MFA(content['data'][0])
130-
saml_endpoint_response.mfa = mfa
126+
if 'data' in content:
127+
if status_message == 'Success':
128+
saml_endpoint_response.saml_response = content['data']
129+
else:
130+
mfa = MFA(content['data'][0])
131+
saml_endpoint_response.mfa = mfa
131132
except:
132133
pass
133134
return saml_endpoint_response

0 commit comments

Comments
 (0)