mailkite_exchange_oauth_token
Exchange an authorization code for an access token or rotate a refresh token to finish linking your MailKite account.
Instructions
Exchange an authorization code for an access token (or rotate a refresh token) — step 3 of linking. Between steps you send the user's browser to /oauth/authorize with your client_id, redirect_uri, state, and an S256 code_challenge; they sign in with whatever method they already use and approve, and the code comes back to your redirect_uri. Then call getApiKey with the access token and store the key. Requires a management session token.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | authorization_code grant: the single-use code from the redirect. Expires quickly and is consumed on first use — a replay returns invalid_grant. | |
| client_id | No | authorization_code grant: required. refresh_token grant: optional, but checked against the token's client when supplied. | |
| grant_type | Yes | Which exchange to perform. | |
| redirect_uri | No | authorization_code grant: must match the redirect_uri used at /oauth/authorize exactly. | |
| code_verifier | No | authorization_code grant: the PKCE verifier whose S256 hash you sent as code_challenge. Required — there is no non-PKCE path. | |
| refresh_token | No | refresh_token grant: the token to rotate. Single-use — the old one is revoked and a new one returned alongside the access token. |