OAuthClient Module
OAuth client for the AT Protocol authorization flow. Implements PKCE (RFC 7636), PAR (RFC 9126), and DPoP (RFC 9449).
Functions and values
| Function or value |
Description
|
Full Usage:
completeAuthorization httpClient clientMetadata authState authorizationCode
Parameters:
HttpClient
clientMetadata : ClientMetadata
authState : AuthorizationState
authorizationCode : string
Returns: Task<Result<OAuthSession, OAuthError>>
|
Complete the authorization flow by exchanging the authorization code for tokens. Call this after the user is redirected back with an authorization code.
|
Full Usage:
createAuthenticatedRequest session httpMethod url nonce
Parameters:
OAuthSession
httpMethod : HttpMethod
url : string
nonce : string option
Returns: HttpRequestMessage
|
Create a DPoP-authenticated HTTP request. Adds the Authorization header with DPoP token type and a DPoP proof header.
|
Full Usage:
refreshToken httpClient clientMetadata session
Parameters:
HttpClient
clientMetadata : ClientMetadata
session : OAuthSession
Returns: Task<Result<OAuthSession, OAuthError>>
|
Refresh an expired access token using the refresh token. Returns a new OAuthSession with updated tokens.
|
Full Usage:
startAuthorization httpClient clientMetadata serverMetadata redirectUri
Parameters:
HttpClient
clientMetadata : ClientMetadata
serverMetadata : AuthorizationServerMetadata
redirectUri : string
Returns: Task<Result<(string * AuthorizationState), OAuthError>>
|
Start an authorization flow. Returns the authorization URL to redirect the user to and the state to save for completing the flow after the callback.
|