The client ID of your AniList API application.
The client secret of your AniList API application.
The authorization code from the redirect URI code query parameter.
OptionalredirectUri: string
The redirect URI registered for your AniList application. This parameter is optional but must match the URI used in buildAuthorizationUrl when AniList requires it.
Optionalsignal: AbortSignal
Optional AbortSignal to cancel the token exchange while it is in flight.
A promise that resolves to the token response containing access_token.
An AniLinkApiError when AniList rejects the exchange, for example with invalid_grant for an invalid or expired code, or an AniLinkNetworkError on transport failure. Errors never include the request body, so the client secret and code are not leaked.
Exchanges an authorization code for an access token using the authorization-code grant.