Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_user call returning different attribute name as part of result object #202

Closed
klpradeepkl opened this issue May 7, 2021 · 6 comments

Comments

@klpradeepkl
Copy link

I am having code as below, as in SDK documentation.

config = {
'orgUrl': 'https://dev-11111.okta.com',
'token': '<>'
}
okta_client = OktaClient(config)
user_info, resp, err = await okta_client.get_user("test2@test.com")
new_profile = user_info.profile
new_profile.nick_name = 'Test'

updated_user_obj = models.User({'profile': new_profile})
updated_user, _, err = await okta_client.update_user("test2@test.com", updated_user_obj)

In the above snippet, user_info object profile attribute has nick_name associated. But in okta, there is no such attribute in Okta. It is actuall nickName in okta. So, when i try to update nick_name in the code, nothing gets updated in okta and result object is none for update_user call.
May be i am missing something really basic ,but i am stuck. I have defined custom attribute(isSSAliasUser) in okta, again for that, get_user call is returning the variable name differently in camelCase notation(isSsAliasUser) . If i try to update the value for the custom attribute, result is none. Nothing gets updated in okta. Can you please direct what mistake is being done.

@serhiibuniak-okta
Copy link
Contributor

@klpradeepkl Thanks, for posting this issue. Your code looks fine. So, when you update nick_name - nothing gets updated? This field was empty before update?
We have related issue for custom attributes - #201
We will cover both issues.

@klpradeepkl
Copy link
Author

Thanks for looking into the issue. That is correct. In Okta tenant, nickName is empty after execution of python script. It was empty before running the script. Result object is none. I am not sure why nick_name needs to be provided (while using python SDK) when in okta, standard attribute name is nickName.

Regarding custom attribute issue, the scenario that i am facing is different. i have infact 2 custom attributes - "ssregion" & "isSSAliasUser" defined in okta. get_user call on the user id is returning, the attribute name as "ssregion" & "isSsAliasUser" (converted to camelcase) respectively. I already have values to these attributes in okta. When i try to do update_user on the new profile object as below, nothing gets updated in okta.

code snippet:
new_profile.isSSAliasUser = True
new_profile.ssregion = ['X', 'Y']

In Okta ( Before python script execution):
ssregion is defined as an array in Okta
ssregion = X
Y
isSSAliasUser True

In Okta ( After python script execution ----> No Change):
ssregion is defined as an array in Okta
ssregion = X
Y
isSSAliasUser True

@serhiibuniak-okta
Copy link
Contributor

Regarding basic attributes: we have casting to snake_case to make naming in "pythonic way". We will consider supporting both naming variants. So, if you provide "nick_name", it works for you?
Regarding custom attributes: yes, that's the issue, we're working on it.

@klpradeepkl
Copy link
Author

As of now both with nick_name and nickName(as in Okta tenant) both are not working.

@serhiibuniak-okta
Copy link
Contributor

@klpradeepkl I've tested updating few fields with latest SDK version (including, nick_name) - it works for me. So, I have few questions:

  1. which version of SDK do you use? v1.6.0 available for now
  2. could you please, turn on logs https://github.com/okta/okta-sdk-python#logging and show http request (hide sensitive information), for example:
2021-05-11 14:35:17,469 - okta-sdk-python - http_client - DEBUG - Request: {'method': 'PUT', 'headers': {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'okta-sdk-python/1.6.0 python/3.8.2 Darwin/19.6.0', 'Authorization': 'SSWS <REDACTED>'}, 'url': 'https://<REDACTED>/api/v1/users/<REDACTED>', 'data': {'profile': {'displayName': 'Sergius', 'email': '<REDACTED>', 'firstName': 'Serhii', 'lastName': 'Buniak', 'login': '<REDACTED>', 'nickName': 'sergius', 'customAttr': 'Value for custom attribute', 'badgeNumber': 123}}}

@serhiibuniak-okta
Copy link
Contributor

@klpradeepkl SDK v1.7.0 has been released, I'm closing this issue as resolved. Feel free to reopen this issue or create a new one if your issue still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants