MCPcopy Create free account
hub / github.com/freecodexyz/free-code / getOrganizationUUID

Function getOrganizationUUID

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

Source from the content-addressed store, hash-verified

452 * @returns The organization UUID or null if not authenticated
453 */
454export async function getOrganizationUUID(): Promise<string | null> {
455 // Check global config first to avoid unnecessary API call
456 const globalConfig = getGlobalConfig()
457 const orgUUID = globalConfig.oauthAccount?.organizationUuid
458 if (orgUUID) {
459 return orgUUID
460 }
461
462 // Fall back to fetching from profile (requires user:profile scope)
463 const accessToken = getClaudeAIOAuthTokens()?.accessToken
464 if (accessToken === undefined || !hasProfileScope()) {
465 return null
466 }
467 const profile = await getOauthProfileFromOauthToken(accessToken)
468 const profileOrgUUID = profile?.organization?.uuid
469 if (!profileOrgUUID) {
470 return null
471 }
472 return profileOrgUUID
473}
474
475/**
476 * 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