MCPcopy Create free account
hub / github.com/Noumena-Network/code / getOrganizationUUIDFromProfile

Function getOrganizationUUIDFromProfile

src/services/oauth/client.ts:558–585  ·  view source on GitHub ↗
(
  accessToken: string,
)

Source from the content-addressed store, hash-verified

556}
557
558async function getOrganizationUUIDFromProfile(
559 accessToken: string,
560): Promise<string | null> {
561 const profile = await getOauthProfileFromOauthToken(accessToken)
562 const profileOrgUUID = profile?.organization?.uuid
563 if (!profileOrgUUID) {
564 return null
565 }
566
567 const accountUuid = profile.account?.uuid
568 const emailAddress = profile.account?.email
569 if (accountUuid && emailAddress) {
570 storeOAuthAccountInfo({
571 accountUuid,
572 emailAddress,
573 organizationUuid: profileOrgUUID,
574 displayName: profile.account.display_name || undefined,
575 hasExtraUsageEnabled:
576 profile.organization?.has_extra_usage_enabled ?? undefined,
577 billingType: profile.organization?.billing_type ?? undefined,
578 accountCreatedAt: profile.account?.created_at,
579 subscriptionCreatedAt:
580 profile.organization?.subscription_created_at ?? undefined,
581 })
582 }
583
584 return profileOrgUUID
585}
586
587/**
588 * Gets the organization UUID from the OAuth access token

Callers 1

getOrganizationUUIDFunction · 0.85

Calls 2

storeOAuthAccountInfoFunction · 0.85

Tested by

no test coverage detected