K
Kinde4mo ago
MikeM

organizations name

I'm using the Nuxt module and trying to get the organizations array with both name and id fields like the one shown in the docs at https://docs.kinde.com/authenticate/manage-authentication/navigate-between-organizations/ I've been able to get the org_codes, but not the names. I'm equally happy with getting this value either client or server side. Any suggestions? Details Settings The organizations claim is enabled in the ID Token is set per the attached screen shot. Test code from Nuxt Server
import { defineEventHandler } from 'h3';


export default defineEventHandler(async (event) => {
const client = event.context.kinde;
console.log('getOrganization', await client.getOrganization())
console.log(`.getClaim('org_name')`, await client.getClaim('org_name'))
console.log('getUserOrganizations', await client.getUserOrganizations())
import { defineEventHandler } from 'h3';


export default defineEventHandler(async (event) => {
const client = event.context.kinde;
console.log('getOrganization', await client.getOrganization())
console.log(`.getClaim('org_name')`, await client.getClaim('org_name'))
console.log('getUserOrganizations', await client.getUserOrganizations())
Results in: getOrganization { orgCode: 'org_63d8e718863' } .getClaim('org_name') { name: 'org_name', value: 'Default Organization' } getUserOrganizations { orgCodes: [ 'org_63d8e718863', 'org_8f5c292370e' ] }
Kinde docs
Build a switch to navigate between organizations
Our developer tools provide everything you need to get started with Kinde.
No description
2 Replies
top kek
top kek4mo ago
await client.getClaimValue(manager, 'organizations', 'id_token')
await client.getClaimValue(manager, 'organizations', 'id_token')
Roshan
Roshan3mo ago
Hello, @MikeM Thanks for sharing the details, everything is very clear, and your request is straightforward. I’m currently reproducing your case to provide a working example or solution. I’ll follow up with you by next Monday at the latest. Appreciate your patience! Hello Mike, Could you please confirm if you encounter any issues accessing the claim using this code?
const organizationsClaim = await client.getClaim('organizations');
const organizationsClaim = await client.getClaim('organizations');
console.log('organizations with names:', organizationsClaim);
console.log('organizations with names:', organizationsClaim);

Did you find this page helpful?