MCPcopy Create free account
hub / github.com/instantdb/instant / exchangeCodeForToken

Function exchangeCodeForToken

client/packages/core/src/authAPI.ts:129–149  ·  view source on GitHub ↗
({
  apiURI,
  appId,
  code,
  codeVerifier,
  refreshToken,
  extraFields,
}: SharedInput & ExchangeCodeForTokenParams)

Source from the content-addressed store, hash-verified

127};
128
129export async function exchangeCodeForToken({
130 apiURI,
131 appId,
132 code,
133 codeVerifier,
134 refreshToken,
135 extraFields,
136}: SharedInput & ExchangeCodeForTokenParams): Promise<CheckMagicCodeResponse> {
137 const res = await jsonFetch(`${apiURI}/runtime/oauth/token`, {
138 method: 'POST',
139 headers: { 'content-type': 'application/json' },
140 body: JSON.stringify({
141 app_id: appId,
142 code: code,
143 code_verifier: codeVerifier,
144 refresh_token: refreshToken,
145 ...(extraFields ? { extra_fields: extraFields } : {}),
146 }),
147 });
148 return res;
149}
150
151export type SignInWithIdTokenParams = {
152 nonce?: string | null | undefined;

Callers

nothing calls this directly

Calls 1

jsonFetchFunction · 0.50

Tested by

no test coverage detected