OAuthContext class abstract

Per-authorization state that must be carried from authorize to callback.

  • codeVerifier: The PKCE code verifier (RFC 7636).
  • state: The opaque state value used to correlate the callback with this authorization request (CSRF protection).
  • dpopNonce: The latest DPoP nonce provided by the server, if any. The dpop-nonce header is optional per RFC 9449, so this may be null when the server has not provided one.
  • issuer: The authorization server issuer identifier resolved via RFC 8414 metadata discovery. Used to validate the iss callback parameter (RFC 9207).
  • tokenEndpoint: The token endpoint resolved via RFC 8414 metadata discovery.
  • dpopPublicKey/dpopPrivateKey: The encoded DPoP key pair generated during authorize and used to sign the DPoP proof on the PAR request. The atproto authorization server binds the pushed authorization request to this key's thumbprint, so the same key pair must be used again for the token request in callback. These may be null for contexts serialized by older versions of this library, in which case callback generates a fresh key pair.
  • pds: The user's Personal Data Server (PDS) URL, carried from authorize so it can be used to populate the resulting session in callback.
  • expectedSub: The expected subject (DID) of the authorized account, carried from authorize so the token response's sub can be verified in callback.

Security warning: when dpopPrivateKey is set, this object contains sensitive key material. Only persist it (e.g. via toJson) into encrypted or otherwise access-controlled storage.

Available extensions
Annotations
  • @freezed

Constructors

OAuthContext({required String codeVerifier, required String state, String? dpopNonce, String? issuer, String? tokenEndpoint, String? dpopPublicKey, String? dpopPrivateKey, String? pds, String? expectedSub})
const
factory
OAuthContext.fromJson(Map<String, Object?> json)
factory

Properties

codeVerifier String
no setterinherited
copyWith → $OAuthContextCopyWith<OAuthContext>
Create a copy of OAuthContext with the given fields replaced by the non-null parameter values.
no setterinherited
dpopNonce String?
no setterinherited
dpopPrivateKey String?
no setterinherited
dpopPublicKey String?
no setterinherited
expectedSub String?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
issuer String?
no setterinherited
pds String?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state String
no setterinherited
tokenEndpoint String?
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_OAuthContext value)) → TResult

Available on OAuthContext, provided by the OAuthContextPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_OAuthContext value)?) → TResult?

Available on OAuthContext, provided by the OAuthContextPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_OAuthContext value)?, {required TResult orElse()}) → TResult

Available on OAuthContext, provided by the OAuthContextPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String codeVerifier, String state, String? dpopNonce, String? issuer, String? tokenEndpoint, String? dpopPublicKey, String? dpopPrivateKey, String? pds, String? expectedSub)?, {required TResult orElse()}) → TResult

Available on OAuthContext, provided by the OAuthContextPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this OAuthContext to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String codeVerifier, String state, String? dpopNonce, String? issuer, String? tokenEndpoint, String? dpopPublicKey, String? dpopPrivateKey, String? pds, String? expectedSub)) → TResult

Available on OAuthContext, provided by the OAuthContextPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String codeVerifier, String state, String? dpopNonce, String? issuer, String? tokenEndpoint, String? dpopPublicKey, String? dpopPrivateKey, String? pds, String? expectedSub)?) → TResult?

Available on OAuthContext, provided by the OAuthContextPatterns extension

A variant of when that fallback to returning null

Operators

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