K
Kinde4mo 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
4 Replies
Claire_Kinde
Claire_Kinde4mo ago
Hi Yvens, let me get someone to look into this for you.
Peteswah
Peteswah4mo 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
Yvens4mo ago
@Peter (Kinde) Thank you 🙏🏾, did I miss this in the documentation ?
Peteswah
Peteswah3mo ago
Its new! I'll add it to the docs soon
Want results from more Discord servers?
Add your server
More Posts
Protect Next.js route handlers with machine-to-machine application?Hi, I want to expose the route handlers defined in Next.js 14 application for external applicationsLogout button doesn't renderedI have implemented user auth using kinde successfully and my ecommerce website is able to login andChaining Middlewares Next.JS Kinde + next-internationalHi, as the title says I'm struggling to figure out how to use two different Next.js middlewares togeHas anyone used kinde_flutter_sdk to build android app?I am having issues building android APK with kinde_flutter_sdk for auth. I install the SDK and withoUnable to login to our dashboard in KindeHello, I'm getting this error when I sign in to my account 404 Domain not found The requested domaiBilling feature launch dateWhen will the billing feature be available to integrate and use. At least give the tentative dateWhat would be the most secure way to create invitation link for users to join an organizations ?I'm using resend to send the invitation link (Nextjs app router SDK). The link should be created witDoes the expo/RN SDK work with react native web?Hi, I am starting a new project and wanted to know if the Expo SDK supports React Native Web?How to prefill "First name" and "Last name" like we can do email with "login_hint"We have a custom authentication page. So email/first name/last name are already curated. We are ableWhy I am getting this error , even though I have setup callback url and redirect url.eroor: The provided authorization grant (e.g., authorization code, resource owner credentials) or re