Skip to main content

Function: exchangeAuthorizationCode()

exchangeAuthorizationCode(host, props, validateResults?): Promise<{ access_token: string; refresh_token: string; token_type: "Bearer"; expires_in: number; }>

Exchange an authorization code for access and refresh tokens (OAuth 2.0).

Parameters​

host​

string

The API host URL

props​

The request properties

body​

{ grant_type: "authorization_code"; code: string; client_id: string; code_verifier: string; redirect_uri: string; client_secret?: string; } = oauthTokenRequestBodySchema

Request body with grant_type, code, client_id, code_verifier, and redirect_uri

body.grant_type​

"authorization_code" = ...

body.code​

string = ...

body.client_id​

string = ...

body.code_verifier​

string = ...

body.redirect_uri​

string = ...

body.client_secret?​

string = ...

validateResults?​

boolean = false

Returns​

Promise<{ access_token: string; refresh_token: string; token_type: "Bearer"; expires_in: number; }>

Promise resolving to access_token, refresh_token, token_type, and expires_in

Operation Id​

oauth-token