K
Kinde9mo 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
CB_Kinde
CB_Kinde8mo ago
Hi Yvens, let me get someone to look into this for you.
Peteswah
Peteswah8mo 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
YvensOP8mo ago
@Peter (Kinde) Thank you 🙏🏾, did I miss this in the documentation ?
Peteswah
Peteswah8mo ago
Its new! I'll add it to the docs soon
Ritesh Mane
Ritesh Mane3mo ago
@Peter (Kinde) I am also getting trouble while using this api getting ResponeError
Yvens
YvensOP3mo 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
onderay3mo ago
What API endpoint are you calling?
Want results from more Discord servers?
Add your server