function exchangeCode
exchangeCode(params: URLSearchParams): Promise<{ id_token: string; token_type: string; }>

Trades a code for an identity token, for POST /api/oauth/tokens, which the client calls server to server with the form params. A code works once, within a minute, for the client and redirect it was made for, and with the verifier whose hash the request carried (PKCE). The token, signed with the instance key and addressed to the client, carries identityClaims and the request's nonce.

Parameters

Return Type

Promise<{ id_token: string; token_type: string; }>

Throws

APIException

400 when anything doesn't match.

Usage

import { exchangeCode } from "api/services/identity-provider-service.ts";