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

Function getOauthProfileFromApiKey

src/services/oauth/getOauthProfile.ts:6–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { logError } from 'src/utils/log.js'
5import { getIdentityClient } from './identityClient.js'
6export 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
29export async function getOauthProfileFromOauthToken(
30 accessToken: string,

Callers

nothing calls this directly

Calls 4

getAuthRuntimeFunction · 0.85
getIdentityClientFunction · 0.85
getCurrentSessionMethod · 0.65
logErrorFunction · 0.50

Tested by

no test coverage detected