OneIdAuth class
Entry point for OneID authentication.
Create one instance per app (near startup), call login to run the
OAuth 2.0 Authorization Code + PKCE flow, and use authenticatedGet /
fetchUserInfo for calls that need the resulting token. Every token
this SDK holds is DPoP-bound (RFC 9449) to a key held in Android
Keystore / iOS Secure Enclave — see OneIdAuthHostApi.
Constructors
- OneIdAuth(OneIdAuthConfig config, {OneIdTokenStorage? tokenStorage, OneIdApiClient? apiClient, OneIdAuthHostApi? hostApi})
Properties
- config → OneIdAuthConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
authenticatedGet(
Uri url) → Future< Map< String, dynamic> > -
Calls
urlwith a valid, DPoP-bound access token attached. -
currentTokens(
) → Future< OneIdAuthResult?> - The current token set, if any, without refreshing it.
-
dispose(
) → void -
Releases the underlying HTTP client. Call when this instance is no
longer needed (e.g.
dispose()of the widget that owns it). -
ensureFreshTokens(
) → Future< OneIdAuthResult> -
Returns a token set guaranteed not to be within
_refreshSkewof expiring, refreshing it first if needed. -
fetchUserInfo(
Uri userInfoEndpoint) → Future< OneIdUserInfo> -
Fetches OIDC claims from
userInfoEndpoint. -
isAuthenticated(
) → Future< bool> - Whether a token set is stored locally. Doesn't guarantee the access token is still valid — use ensureFreshTokens before making a call.
-
login(
) → Future< OneIdAuthResult> - Runs the authorization flow (opens the system browser, handles the redirect, exchanges the code for tokens) and persists the result.
-
logout(
) → Future< void> - Ends the session: attempts RP-initiated logout if OneIdAuthConfig.endSessionEndpoint is configured, then always clears local token storage regardless of whether that call succeeds.
-
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