OAuth2Client<T extends SecureOAuth2Token> class
A client that handles the complete OAuth2 flow
Handles token generation, storage, and refreshing
Constructors
-
OAuth2Client({required String key, required Dio dio, Dio? oauthDio, OAuth2Endpoints? endpoints, Uri? discoveryUri, required Uri redirectUri, String callbackUrlScheme = 'https', OAuth2ClientCredentials? credentials, Set<
String> scope = const {}, OAuth2TokenDecoder<T> ? tokenDecoder, ReAuthenticationCallback<T> ? onReAuthenticate, String? redirectOriginOverride, OAuth2Verification verification = const OAuth2Verification()}) - Create an OAuth2 client
Properties
- callbackUrlScheme → String
-
The callback url scheme for native platforms
final
- credentials → OAuth2ClientCredentials?
-
The client credentials
final
- dio → Dio
-
Access to the OAuth dio client
final
- discoveryUri → Uri?
-
The discovery URI
final
-
fresh
↔ Fresh<
T> -
The token refresher
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- oauthDio → Dio
-
The client to use for OAuth operations
final
- redirectOriginOverride → String?
-
Only has an effect on Web!
Can be used to override the origin of the redirect URL.
This is useful for cases where the redirect URL is not on the same
domain (e.g. local testing).
final
- redirectUri → Uri
-
The redirect URI
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scope
→ Set<
String> -
The OAuth scope to request
final
-
tokenDecoder
→ OAuth2TokenDecoder<
T> -
A function that decodes the token
final
- verification → OAuth2Verification
-
Verification configuration
final
Methods
-
authenticate(
{Future< String> ? interceptCallback}) → Future<T> - Perform the entire OAuth2 flow
- Perform the OAuth2 authorization flow
-
endSession(
) → Future< void> - End the current session
-
isAuthenticated(
) → Future< bool> - Check if the user is authenticated
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
{required T token}) → Future< T> - Refresh the OAuth2 token
-
revoke(
) → Future< void> - Revoke the OAuth2 token
-
token(
{required OAuthAuthorization authorization}) → Future< T> - Perform the OAuth2 token exchange
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited