K
Kinde7mo ago
Yvens

Kinde Management api

Did I misunderstood something here ? I'm trying to create a user with the role "user", but Kinde does not seem to pick it up. It does not reflect on the dashboard. The key of the role I created is "user"
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
Thank you
7 Replies
Claire_Kinde
Claire_Kinde7mo ago
Hi Yvens, let me get someone to look into this for you.
Peteswah
Peteswah7mo ago
Hey @Yvens, for the changes to be updated in your app you will need to get the most up to date tokens from kinde. You can do this by using refreshTokens which is available via getKindeServerSession basically to your code you can just add
const {refreshTokens} = getKindeServerSession();

...
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
await refreshTokens()
const {refreshTokens} = getKindeServerSession();

...
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
await refreshTokens()
Yvens
YvensOP7mo ago
@Peter (Kinde) Thank you 🙏🏾, did I miss this in the documentation ?
Peteswah
Peteswah7mo ago
Its new! I'll add it to the docs soon
Ritesh Mane
Ritesh Mane2mo ago
@Peter (Kinde) I am also getting trouble while using this api getting ResponeError
Yvens
YvensOP2mo ago
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
onderay
onderay2mo ago
What API endpoint are you calling?
Want results from more Discord servers?
Add your server