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

Support custom attributes in UserProfile type #238

Open
JuanCaicedo opened this issue Apr 15, 2021 · 8 comments
Open

Support custom attributes in UserProfile type #238

JuanCaicedo opened this issue Apr 15, 2021 · 8 comments

Comments

@JuanCaicedo
Copy link

Hi there! I'm looking to switch over to use your new typescript definitions (thank you! 😀) and am running into an issue.

My organization currently defines some custom attributes as part of the user profile. However, it looks to me like the UserProfile type has not way of accounting for these other attributes, which is causing my code that tries to access them to not compile.

I wanted to flag this and see if this is a known issue or if there's something I'm overlooking 😄

If this does need to be addressed, I'm not sure what would be a good strategy. Perhaps leveraging somehow generics on the User/UserProfile type to represent the custom properties?

Thank you!

@arvindkrishnakumar-okta

Thanks for posting!

@shuowu-okta can you help with this?

@theseyi
Copy link

theseyi commented Apr 24, 2021

@JuanCaicedo how are you retrieving the custom properties on the user profile? The getUser api does not seem to return custom properties even outside of typing constraints...

@JuanCaicedo
Copy link
Author

@theseyi When I call getUser it comes back with a profile including those custom properties 😅

@theseyi
Copy link

theseyi commented Apr 29, 2021

@theseyi When I call getUser it comes back with a profile including those custom properties 😅

I see, I guess someone already updated the schéma in your Okta org to apply those custom fields to the user type... 🤔

@mlahp7
Copy link

mlahp7 commented Jun 9, 2021

We're using custom properties as well, any updates on this?

@JuanCaicedo
Copy link
Author

JuanCaicedo commented Jun 9, 2021

We ended building our own profile type by

type OktaUser = Awaited<ReturnType<Client['createUser']>>
type OktaUserProfile = OktaUser['profile']
interface CustomUserProfile extends OktaUserProfile {
  customProperty?: string
}

export interface CustomOktaUser extends OktaUser {
  profile: CustomUserProfile
}

@mgrubb
Copy link

mgrubb commented Nov 7, 2022

I'm having a similar issue but with Group profiles. Whenever I try to access any of the custom attributes I get 'property' does not exists on type 'GroupProfile'. Any guidance from Okta would be appreciated.

@oleksandrpravosudko-okta
Copy link
Contributor

@mgrubb index signature was added for extensible types in 6.6.0 - can you please check if it works for you?

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

6 participants