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

Okta HTTP 400 E0000001 Api validation failed: Property not found (when they are available in payload) #421

Open
qbui-os opened this issue Oct 16, 2024 · 2 comments

Comments

@qbui-os
Copy link

qbui-os commented Oct 16, 2024

Okta version: 2.9.8

Descriptions

Hi, I am trying to update an Application User profile using update_application_user() but keep encountering this error:

Okta HTTP 400 E0000001 Api validation failed: assignment\nProperty 'givenName' not found. Property 'familyName' not found"

The problem is, givenName & familyName properties are already existing inside the User profile payload & not NULL. I cannot provide the payload due to customer data protection policy, but the profile looks something like this.

'profile': {'streetAddress': '',
  'zoneinfo': 'America/Los_Angeles',
  'locale': 'en-US',
  'nickname': 'aasdsad',
  'email': '[email protected]',
  'locality': '',
  'givenName': 'asasc',
  'accountId': 'someId',
  'name': 'asasc aaaa',
  'phoneNumber': '',
  'userType': 'some type',
  'region': '',
  'familyName': 'aaaa'},

What I have done

  1. https://github.com/okta/okta-sdk-python?tab=readme-ov-file#update-a-user
  2. Passing the updated AppUser object to app_user param
  3. Convert the AppUser to a dict and pass the dict to app_user param
  4. Adding assignment: {givenName, familyName} property to the User dict
  5. Adding giveName and familyName directly to the User dict
  6. Adding give_name and family_name to User profile (based on sample on Okta API Doc, I thought maybe there is some sort of mapping?)
  7. I even pass the original AppUser (without modification) to app_user, still the same error
@qbui-os
Copy link
Author

qbui-os commented Oct 16, 2024

Also I did follow the instruction to fetch the Application User, then modify the profile, I did not generate the profile by code.

@qbui-os
Copy link
Author

qbui-os commented Oct 16, 2024

I tried the above steps for many hours before submitting this ticket. However, I successfully moved pass the error just now.

What I did

I simply removed all the properties in the profile that I don't wanna update (or keep the current value from Okta), and it just work?...

I only needed to change the accountId, so my successful payload was:

{'profile': {'accountId': 'newId'}}

This is REALLY confusing, because the only reason I kept the entire App User profile fetched on Okta is because of this note on the Okta API Doc:

Note: The Okta API currently doesn't support entity tags for conditional updates. As long as you're the only user updating the the user profile, Okta recommends you fetch the most recent profile with Retrieve an Application User, apply your profile update, and then POST back the updated profile.

I noticed the strange behavior while playing with the keep_empty_params flag, when I set it to True, even more properties appear in the error message (all of the existed and not null/empty, yet were reported 'not found' by the error). So I took a wild guess "less is more" and deleted all the unchanged properties and gave it one last go, and... WALAH.

My thoughts

  1. The error message is very confusing, it really had nothing to do with what was going wrong at all, all the required properties were there.
  2. The OKTA API Doc note, just why? Did I misunderstood the note, because I don't really know how else to interpret it.

@qbui-os qbui-os changed the title Okta HTTP 400 E0000001 Api validation failed: assignment\nProperty 'givenName' not found. Property 'familyName' not found" Okta HTTP 400 E0000001 Api validation failed: Property not found (when they are available in payload) Oct 19, 2024
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

1 participant