({
apiURI,
appId,
code,
codeVerifier,
refreshToken,
extraFields,
}: SharedInput & ExchangeCodeForTokenParams)
| 127 | }; |
| 128 | |
| 129 | export 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 | |
| 151 | export type SignInWithIdTokenParams = { |
| 152 | nonce?: string | null | undefined; |
nothing calls this directly
no test coverage detected