( accessToken: string, )
| 556 | } |
| 557 | |
| 558 | async 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 |
no test coverage detected