Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mfa_challenge_url = selected_mfa_option['_links']['verify']['href']
payload = helpers.prepare_payload(stateToken=primary_auth['stateToken'],
factorType=selected_mfa_option['factorType'],
provider=selected_mfa_option['provider'],
profile=selected_mfa_option['profile'])
selected_factor = okta_verify_api_method(
mfa_challenge_url, payload, headers)
mfa_provider = selected_factor["_embedded"]["factor"]["provider"].lower()
logging.debug("MFA Challenge URL: [{}] headers: {}".format(
mfa_challenge_url, headers))
if mfa_provider == "duo":
payload, headers, callback_url = duo_helpers.authenticate_duo(
selected_factor)
okta_verify_api_method(callback_url, payload)
payload.pop("id", "sig_response")
mfa_verify = okta_verify_api_method(
mfa_challenge_url, payload, headers)
elif mfa_provider == "okta" or mfa_provider == "google":
mfa_verify = user_mfa_options(selected_mfa_option,
headers, mfa_challenge_url, payload, primary_auth)
else:
logging.error("Sorry, the MFA provider '{}' is not yet supported."
" Please retry with another option.".format(mfa_provider))
exit(1)
return mfa_verify['sessionToken']