Custom Properties

I've added a custom property AND included it in the applications token(s). I then added the data to the user and console logged the user. The Kinde created property shows in the user object but not the custom one. Any thoughts? Also if it did show how do I access it in Client and Server components? The properties seem hardcoded in Typescript.
8 Replies
dillorscroft
dillorscroft3mo ago
I'm using "@kinde-oss/kinde-auth-nextjs": "^2.3.6" and have seen the links posted on a similar thread https://discord.com/channels/1070212618549219328/1269986274081636373/1269986274081636373 but somethign as simple as showing the user object in the console shows only Kinde created properties not custom. Both claims are in the raw access token BTW.
Claire_Kinde
Claire_Kinde3mo ago
Hey there. I'll check in with the team about this. Can you share your Kinde business name please?
dillorscroft
dillorscroft3mo ago
GreenPerks
Peteswah
Peteswah3mo ago
Hey @dillorscroft thanks for bringing this up - probably not the best experience here. I'll see do some investigation and see if there is a way to grab the custom properties with the existing helper functions. If that's not possible I'll make it possible. In the meantime I think you can use the getClaimValue / getClaim helpers
dillorscroft
dillorscroft3mo ago
Any update? Thanks
Claire_Kinde
Claire_Kinde3mo ago
Thanks for your patience. We're working on it and will let you know when we have more information.
dillorscroft
dillorscroft3mo ago
Using KindeBrowserClient I can get the claims from the AccessToken like below; Without giving too much away about my architecture this works; console.log(MemberId: ${accessToken?.user_properties?.gp_usr_member_id.v}); console.log(AccountId: ${accessToken?.external_org_id}); but the MemberId claim is simply not available using any helpers including getClaim; Actually even this doesnt work for me with a Kinde created Property console.log(City: ${getClaim('kp_usr_city', 'access_token')?.value});
This is included in the access token and applied to the application as a token
Peteswah
Peteswah3mo ago
Hey guys, there is a PR waiting to get merged with the changes The getUser function will return a user with the custom properties as long as they are in the token. You will have to define which custom properties you have to get the TS autocomplete to work. So const user = await getUser<{myCustomProp: string}>().
{
id: ...,
first_name: ...,
...,
properties: {
...,
myCustomProp: "hello world"
}
}
{
id: ...,
first_name: ...,
...,
properties: {
...,
myCustomProp: "hello world"
}
}
Want results from more Discord servers?
Add your server