Kenton
Kenton
KKinde
Created by Kenton on 9/12/2024 in #💻┃support
Do Roles or Permissions update immediately in user session?
I am wanting to restrict access to certain NextJS routes and pages to users with either a role or permission but on update (only tested with roles), the role remain the same. My use-case is, I want to allow admins to edit members roles and user data but after updating the user, their data server or client side does not reflect the updated role. How would you recommend handling this? Thanks
16 replies
KKinde
Created by Kenton on 8/27/2024 in #💻┃support
Kinde Management API - 400 Bad Request: malformed Host header
I am trying to create an Organization and move a user that's in the Default Organization into it using the Kinde Management API; however, I am getting the error:
Error creating organization or adding user: A [ApiError]: Error creating user.
at xt (webpack-internal:///(rsc)/./node_modules/@kinde/management-api-js/dist/kinde-management-api-js.cjs:1:25453)
at eval (webpack-internal:///(rsc)/./node_modules/@kinde/management-api-js/dist/kinde-management-api-js.cjs:1:26058)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
url: 'https://{your_subdomain}.kinde.com/api/v1/organization',
status: 400,
statusText: 'Bad Request: malformed Host header',
body: '400 Bad Request: malformed Host header',
request: {
method: 'POST',
url: '/api/v1/organization',
body: { name: 'test-org', handle: 'test-org' },
mediaType: 'application/json',
errors: {
'400': 'Error creating user.',
'403': 'Invalid credentials.',
'429': 'Request was throttled.',
'500': 'Could not create organization.'
}
}
}
Error creating organization or adding user: A [ApiError]: Error creating user.
at xt (webpack-internal:///(rsc)/./node_modules/@kinde/management-api-js/dist/kinde-management-api-js.cjs:1:25453)
at eval (webpack-internal:///(rsc)/./node_modules/@kinde/management-api-js/dist/kinde-management-api-js.cjs:1:26058)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
url: 'https://{your_subdomain}.kinde.com/api/v1/organization',
status: 400,
statusText: 'Bad Request: malformed Host header',
body: '400 Bad Request: malformed Host header',
request: {
method: 'POST',
url: '/api/v1/organization',
body: { name: 'test-org', handle: 'test-org' },
mediaType: 'application/json',
errors: {
'400': 'Error creating user.',
'403': 'Invalid credentials.',
'429': 'Request was throttled.',
'500': 'Could not create organization.'
}
}
}
I started by trying to enable Kinde Management API in the Kinde Console for my NextJS app but got the error: "m2m applications can have access the kinde management api" So I create a M2M application, added the following env variables:
KINDE_DOMAIN=https://my-handle.kinde.com
KINDE_MANAGEMENT_CLIENT_ID=m2m-application-client-id
KINDE_MANAGEMENT_CLIENT_SECRET=m2m-application-client-secret
KINDE_DOMAIN=https://my-handle.kinde.com
KINDE_MANAGEMENT_CLIENT_ID=m2m-application-client-id
KINDE_MANAGEMENT_CLIENT_SECRET=m2m-application-client-secret
15 replies