()
| 4 | import { logError } from 'src/utils/log.js' |
| 5 | import { getIdentityClient } from './identityClient.js' |
| 6 | export async function getOauthProfileFromApiKey(): Promise< |
| 7 | OAuthProfileResponse | undefined |
| 8 | > { |
| 9 | const session = getAuthRuntime().getCurrentSession() |
| 10 | const accountUuid = session.identity.accountUuid |
| 11 | const apiKey = session.hasUsableApiKey ? session.apiKey : null |
| 12 | |
| 13 | // Need both account UUID and API key to check |
| 14 | if (!accountUuid || !apiKey) { |
| 15 | return |
| 16 | } |
| 17 | try { |
| 18 | return await getIdentityClient().getOauthProfileFromApiKey({ |
| 19 | apiKey, |
| 20 | accountUuid, |
| 21 | betaHeader: OAUTH_BETA_HEADER, |
| 22 | timeout: 10000, |
| 23 | }) |
| 24 | } catch (error) { |
| 25 | logError(error as Error) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | export async function getOauthProfileFromOauthToken( |
| 30 | accessToken: string, |
nothing calls this directly
no test coverage detected