OAuthClient class final

Constructors

OAuthClient(OAuthClientMetadata metadata, {String service = 'bsky.social', String? pds, String? expectedSub, Client? httpClient})
const

Properties

expectedSub String?
The DID this OAuth flow is expected to authenticate, when known.
final
hashCode int
The hash code for this object.
no setterinherited
metadata OAuthClientMetadata
Client metadata to be used during authentication.
final
pds String?
The user's personal data server origin (e.g. https://morel.us-east.host.bsky.network), when this client was created via resolveFromPds or resolveFromIdentity. Purely informational for API calls after authentication; null when the client was constructed directly.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
service String
Service for which the account to be authenticated exists.
final

Methods

authorize([String? identity]) Future<(Uri, OAuthContext)>
Initiates an OAuth 2.0 authorization request using Pushed Authorization Requests (PAR) with PKCE (Proof Key for Code Exchange) and DPoP (Demonstrating Proof of Possession).
callback(String callback, OAuthContext context, {String? issuer}) Future<OAuthSession>
Processes the OAuth 2.0 authorization callback with DPoP (Demonstrating Proof of Possession) support.
getServerMetadata() Future<OAuthServerMetadata>
Fetches OAuth 2.0 Authorization Server Metadata (RFC 8414) from https://<service>/.well-known/oauth-authorization-server.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh(OAuthSession session) Future<OAuthSession>
Refreshes an OAuth 2.0 access token using DPoP-bound refresh token flow.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

resolveFromIdentity(OAuthClientMetadata metadata, String identity, {String handleResolver = 'https://public.api.bsky.app', String plcDirectory = 'https://plc.directory', Client? httpClient}) Future<OAuthClient>
Resolves an atproto identity (handle or DID) down to its OAuth authorization server and returns a ready-to-use OAuthClient.
resolveFromPds(OAuthClientMetadata metadata, String pds, {Client? httpClient}) Future<OAuthClient>
Resolves the OAuth authorization server for a user's PDS and returns a ready-to-use OAuthClient.