I am trying to enable default MFA for Openstack user using Python keystoneclient API keystoneclient.users.update
I have sample API curl command from Openstack documentation, where you update the "options" attribute of user account with JSON object
{
"user": {
"options": {
"multi_factor_auth_enabled": true,
"multi_factor_auth_rules": [
["password", "totp"]
]
}
}
}
when I am trying to update the same in Python code I am getting below error
keystoneauth1.exceptions.http.BadRequest: Invalid input for field 'options': u'{ "multi_factor_auth_enabled": true, "multi_factor_auth_rules": [["password", "totp"]]}' is not of type 'object'
Failed validating 'type' in schema['properties']['options']:
my code is like this
MFA_dict = '{ "multi_factor_auth_enabled": true, "multi_factor_auth_rules": [["password", "totp"]]}'
user = keystone.users.update(user_id, options=MFA_dict)
Never mind I figured it out. MFA_dict was string, so I had to just remove single quotes and make the object dictionary.
and make lower case true into uppercase True to make it boolean