McpOAuth class
One client's authorization with the MCP servers it talks to.
Constructors
- McpOAuth(McpOAuthOptions options, {Client? httpClient})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- options → McpOAuthOptions
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
accessToken(
String serverUrl) → Future< String?> -
The access token for
serverUrl, refreshed when it has expired; null when there is none (the server's 401 starts an authorization). -
The authorization server's metadata: tried at each well-known
location in turn; the document must name
issuerexactly. -
begin(
{required String serverUrl, String? wwwAuthenticate, List< String> keepScopes = const []}) → Future<({PendingAuthorization pending, Uri url})> -
The first half: discover, register, and build the authorization URL.
keepScopesare scopes already held that a step-up must not lose. -
close(
) → void -
complete(
PendingAuthorization pending, Uri redirect) → Future< OAuthGrant> -
The second half: judge the redirect the authorization server sent
back and redeem its code. The issuer is checked first, then
state; anerroris reported only once both hold. -
handleChallenge(
{required String serverUrl, required int status, String? wwwAuthenticate}) → Future< bool> -
Answer a 401 or 403 from
serverUrl: authorize (or step up) through McpOAuthOptions.authorize. True when there is a new token to retry with; false when this client cannot (noauthorize, or step-ups spent). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited