e0
e0
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
Thanks for the answers @Colin Makes sense to cache the M2M tokens. Hopefully the team can improve these aspects into the SDKs like you mentioned. Great that you could find a workaround for now though and shared with us ❤️
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
Hi! We haven't looked more at this since it's a very low-prio issue, but thank you for sharing! I took a look at your solution and that was a clever workaround. Do you notice any significant delays in response time using this method? I'm also concerned about this eating up the M2M tokens very quickly. My understanding is that whenever the Management API needs to be used, an M2M token is required. https://kinde.com/docs/build/add-a-m2m-application-for-api-access/#how-m2m-tokens-are-calculated-in-kinde
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
Thank you for the help @viv (kinde) . I give this a try for a few minutes but couldn't get it to work. Also a bit confused at this point about client_id vs the actual user's id for this endpoint. It's not an essential feature for us at this moment so I will give up on it for now. Appreciate all the team from the support though.
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
That actually sounds way more concerning. Like if you are revoking certain permissions for a user and they are still signed in at the time. It sounds like they will still have access to their old permissions?
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
@Daniel_Kinde Thanks for your response. In order to use that endpoint we would need the current refresh_token right? According to KindeAI it seems like it's not possible to get the refresh_token. https://discord.com/channels/1070212618549219328/1205662406446162020/1205682723411206205 Here is what we are doing so far if you are interested. I think we are probably just going to settle for having a label saying the user needs to log out and log back in for the name to be updated.
const tokenResponse = await fetch(`${KINDE_ISSUER_URL}/oauth2/token`, {
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
audience: `${KINDE_ISSUER_URL}/api`,
grant_type: 'client_credentials',
client_id: KINDE_CLIENT_ID,
client_secret: KINDE_CLIENT_SECRET,
}),
});

const { access_token } = await tokenResponse.json();

await fetch(`${KINDE_ISSUER_URL}/api/v1/user?id=${user.id}`, {
method: 'PATCH',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${access_token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ given_name, family_name }),
});

await fetch(
`${KINDE_ISSUER_URL}/api/v1/users/${user.id}/refresh_claims`,
{
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${access_token}`,
},
}
);
const tokenResponse = await fetch(`${KINDE_ISSUER_URL}/oauth2/token`, {
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
audience: `${KINDE_ISSUER_URL}/api`,
grant_type: 'client_credentials',
client_id: KINDE_CLIENT_ID,
client_secret: KINDE_CLIENT_SECRET,
}),
});

const { access_token } = await tokenResponse.json();

await fetch(`${KINDE_ISSUER_URL}/api/v1/user?id=${user.id}`, {
method: 'PATCH',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${access_token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ given_name, family_name }),
});

await fetch(
`${KINDE_ISSUER_URL}/api/v1/users/${user.id}/refresh_claims`,
{
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${access_token}`,
},
}
);
18 replies
KKinde
Created by e0 on 2/9/2024 in #💻┃support
Updating a user's name
Hi @Colin, thanks for looking at this. I did try to refresh the claims using the /api/v1/users/user_id/refresh_claims endpoint. I checked the response and it actually says it has been successfully refreshed, but I think the problem is that the user session token is still not updated. I'm using the SvelteKit SDK. KindeAI just tells me that with this SDK I wouldn't have to manually manage the tokens, but I think I would need force an update on the id token for this to be updated. Just not sure how to do that.
18 replies
KKinde
Created by saM69420 on 11/27/2023 in #💻┃support
New Application Environments
Would love to see these improvements for environments too. Just wanted to say that it's so cool that we have API access for everything already though. Your documentation on Postman maps pretty well to the RapidAPI macOS client (formerly Paw). The web UX is a bit tedious atm, but it's reassuring to be able to compare and look at the diffs between environments using the API. Nice job ❤️
22 replies