pub async fn oauth_complete(
http_client: &Client,
oauth_client: &OAuthClient,
dpop_key_data: &KeyData,
callback_code: &str,
oauth_request: &OAuthRequest,
document: &Document,
) -> Result<TokenResponse, OAuthClientError>
Expand description
Completes the OAuth authorization flow by exchanging the authorization code for tokens.
This function performs the final step of the OAuth authorization code flow by exchanging the authorization code received from the callback for access and refresh tokens. It handles DPoP proof generation and client assertion creation for secure token exchange.
§Arguments
http_client
- The HTTP client to use for making requestsoauth_client
- The OAuth client configurationdpop_key_data
- The key data for creating DPoP proofscallback_code
- The authorization code received from the callbackoauth_request
- The original OAuth request statedocument
- The identity document containing PDS endpoints
§Returns
A TokenResponse
containing the access token, refresh token, and metadata on success.
§Errors
Returns OAuthClientError
if the token exchange fails or response parsing fails.