MCPcopy
hub / github.com/codeaashu/claude-code / getOrganizationUUID

Function getOrganizationUUID

src/services/oauth/client.ts:426–445  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

424 * @returns The organization UUID or null if not authenticated
425 */
426export async function getOrganizationUUID(): Promise<string | null> {
427 // Check global config first to avoid unnecessary API call
428 const globalConfig = getGlobalConfig()
429 const orgUUID = globalConfig.oauthAccount?.organizationUuid
430 if (orgUUID) {
431 return orgUUID
432 }
433
434 // Fall back to fetching from profile (requires user:profile scope)
435 const accessToken = getClaudeAIOAuthTokens()?.accessToken
436 if (accessToken === undefined || !hasProfileScope()) {
437 return null
438 }
439 const profile = await getOauthProfileFromOauthToken(accessToken)
440 const profileOrgUUID = profile?.organization?.uuid
441 if (!profileOrgUUID) {
442 return null
443 }
444 return profileOrgUUID
445}
446
447/**
448 * Populate the OAuth account info if it has not already been cached in config.

Callers 15

callFunction · 0.85
pollRemoteSessionEventsFunction · 0.85
teleportToRemoteFunction · 0.85
archiveRemoteSessionFunction · 0.85
checkGithubAppInstalledFunction · 0.85
checkGithubTokenSyncedFunction · 0.85
fetchEnvironmentsFunction · 0.85
prepareApiRequestFunction · 0.85
createBridgeSessionFunction · 0.85
getBridgeSessionFunction · 0.85

Calls 3

getGlobalConfigFunction · 0.85
hasProfileScopeFunction · 0.50

Tested by

no test coverage detected