K
Kinde3mo ago
Tempo

Assigning identities when creating a user.

Using https://github.com/kinde-oss/management-api-js I am unable to add identities of type 'email' or 'phone'. I am able to create the user in org without the identities array but when adding the array the only type that seems to be working is 'username'. I initially tried everything formatted exactly as is in the doc 'JavaScript fetch' code snippet. https://docs.kinde.com/kinde-apis/management/?subdomain=&token=#tag/users/post/api/v1/user When trying everything individually only type: 'username' does not come back with 'Bad Request'. When trying all the details together only type: 'username' works and only the username is saved.
GitHub
GitHub - kinde-oss/management-api-js: javascript package for intera...
javascript package for interacting with the Kinde Management API - kinde-oss/management-api-js
Kinde docs
Kinde Management API
The management API is for managing your Kinde account. Most things that can be done via the Kinde admin UI can be done with this API
2 Replies
Tempo
TempoOP3mo ago
Update: This works in the 'Test Request' environment. Does not work with the SDK when using requstBody.
await kindeSDK.Users.createUser({
requestBody: {
profile: {
given_name: submission.value.newUserFirstName,
family_name: submission.value.newUserLastName
},
organization_code: submission.value.kindeOrgId,
identities: [{
type: "username",
details: {
username: submission.value.newUserUsername
}
}, {
type: "email",
details: {
email: submission.value.newUserEmail,
}
}, {
type: "phone",
details: {
phone: submission.value.newUserPhoneNumber,
phone_country_id: "nz",
}
}]
}
})
await kindeSDK.Users.createUser({
requestBody: {
profile: {
given_name: submission.value.newUserFirstName,
family_name: submission.value.newUserLastName
},
organization_code: submission.value.kindeOrgId,
identities: [{
type: "username",
details: {
username: submission.value.newUserUsername
}
}, {
type: "email",
details: {
email: submission.value.newUserEmail,
}
}, {
type: "phone",
details: {
phone: submission.value.newUserPhoneNumber,
phone_country_id: "nz",
}
}]
}
})
note: the SDK does not error when passing an empty object.
await kindeSDK.Users.createUser({})
await kindeSDK.Users.createUser({})
This however does not include the user details.
Ages
Ages4w ago
Hi @Tempo , Thanks for providing the details. It seems like there may be an issue with how the identities array is being sent in your request using the SDK. Based on your description, the SDK does not raise an error when an empty object is passed, but fails when adding the identities array with email and phone types. I would suggest trying to use the API directly via fetch to see if the issue persists. It could also be related to how the request body is formatted, or the SDK’s handling of the identities array. If you’re still experiencing issues, we can escalate this to the team for a deeper look. Let me know if that works or if you need further assistance. Best regards, Ages Hi @Tempo , Have you had a chance to try using the API directly via fetch as suggested? If the issue persists or you need further assistance, please let us know, and we can escalate this matter to the development team for a closer look otherwise we’ll assume the issue has been resolved and will proceed to close the ticket. Please feel free to reach out if there’s anything else we can assist you with.

Did you find this page helpful?