Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Kinde · Function

getOrganization

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.

How it works

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.

Syntax

kindeClient.getOrganization(sessionManager);

Parameters

NameTypeDescription
sessionManagersession managerSession manager used by the SDK to access the signed-in user’s session.

Returns

An organization-details object containing orgCode, for example {"orgCode":"org_1234"}.

Key points

  • The SDK groups getOrganization with getUserOrganizations as helpers for extracting organization information.
  • In the TypeScript SDK, call the method with sessionManager and await the organization object.
  • The method resolves details for the organization tied to the user’s current login.
  • Use getUserOrganizations instead when the requirement is to retrieve the user’s organization codes collectively.

Common mistakes

  • This function concerns the organization the user is currently logged into, not an arbitrary organization lookup.

Example: Get the signed-in organization

const org = await kindeClient.getOrganization(sessionManager);
console.log(org.orgCode);

Retrieves the signed-in user’s organization and prints its organization code.

When to use it

Identify the active organization

Determine which organization is associated with the current authenticated session.

Use the organization code

Pass the current organization identifier to application authorization or tenant-aware logic.

Interview questions

QWhat does getOrganization do?

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.

QHow do you call getOrganization in the TypeScript SDK?

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.

QWhat does the returned value contain?

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.

  • getUserOrganizations
  • orgCode
  • sessionManager

Source: TypeScript. Checked 2026-10-15.