Identify the active organization
Determine which organization is associated with the current authenticated session.
Kinde · Function
Retrieves details for the organization associated with the signed-in user. In the TypeScript SDK, it is called with a session manager and returns an object containing the organization code.
Call getOrganization with the session manager to obtain details about the organization associated with the currently signed-in user. The documented result contains an orgCode value identifying that organization.
kindeClient.getOrganization(sessionManager);| Name | Type | Description |
|---|---|---|
sessionManager | session manager | Session manager used by the SDK to access the signed-in user’s session. |
An organization-details object containing orgCode, for example {"orgCode":"org_1234"}.
const org = await kindeClient.getOrganization(sessionManager);
console.log(org.orgCode);Retrieves the signed-in user’s organization and prints its organization code.
Determine which organization is associated with the current authenticated session.
Pass the current organization identifier to application authorization or tenant-aware logic.
It retrieves details for the organization associated with the signed-in user. In the TypeScript SDK, pass the sessionManager argument and await the returned value.
Follow-up: What identifier does the documented example return? It returns an object containing an orgCode such as org_1234.
The TypeScript SDK signature is kindeClient.getOrganization(sessionManager). The call is asynchronous, so it should be awaited before using the result.
Follow-up: How would you inspect the result? Store the awaited value and read its orgCode property.
The function returns organization details represented by an object such as { orgCode: 'org_1234' }. The orgCode identifies the organization connected to the user’s session.
Follow-up: How can you obtain all organizations instead? Use getUserOrganizations, which returns an object containing orgCodes.
getUserOrganizationsorgCodesessionManager