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

Function exchangeCodeForTokens

src/services/oauth/identityClient.ts:93–109  ·  view source on GitHub ↗
({ requestBody, timeout })

Source from the content-addressed store, hash-verified

91 },
92
93 async exchangeCodeForTokens({ requestBody, timeout }) {
94 // Noumena's authorization_code grant currently requires a form-encoded
95 // body even though refresh_token accepts JSON.
96 const response = await axios.post<OAuthTokenExchangeResponse>(
97 getOauthTokenUrl(),
98 new URLSearchParams(
99 Object.entries(requestBody).map(([key, value]) => [key, String(value)]),
100 ),
101 {
102 headers: {
103 'Content-Type': 'application/x-www-form-urlencoded',
104 },
105 timeout,
106 },
107 )
108 return response.data
109 },
110
111 async refreshOAuthToken({ requestBody, timeout }) {
112 const response = await axios.post<OAuthTokenExchangeResponse>(

Callers

nothing calls this directly

Calls 2

getOauthTokenUrlFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected