OAuthConfig class
Configuration for Frappe OAuth2 authentication
Contains all necessary configuration for OAuth2 flow including server endpoints, client credentials, and SDK behavior settings.
- Annotations
-
- @JsonSerializable.new()
Constructors
-
OAuthConfig({required String baseUrl, required String clientId, required String redirectScheme, List<
String> scopes = const ['all', 'openid'], Duration tokenRefreshThreshold = const Duration(minutes: 5), bool autoRefresh = true, StorageType storageType = StorageType.secure, String? customAuthorizationEndpoint, String? customTokenEndpoint, String? customUserInfoEndpoint, Map<String, String> additionalAuthParams = const {}, Duration networkTimeout = const Duration(seconds: 30), bool enableLogging = false}) -
const
-
OAuthConfig.fromJson(Map<
String, dynamic> json) -
Creates an OAuthConfig from JSON
factory
Properties
-
additionalAuthParams
→ Map<
String, String> -
Additional parameters to include in authorization request
final
-
Gets the authorization endpoint URL
no setter
- autoRefresh → bool
-
Whether to automatically refresh tokens in the background
final
- baseUrl → String
-
Base URL of the Frappe server (e.g., 'https://your-site.frappe.cloud')
final
- clientId → String
-
OAuth2 client ID registered in Frappe
final
- customAuthorizationEndpoint → String?
-
Custom authorization endpoint (if different from default)
final
- customTokenEndpoint → String?
-
Custom token endpoint (if different from default)
final
- customUserInfoEndpoint → String?
-
Custom user info endpoint (if different from default)
final
- enableLogging → bool
-
Whether to enable debug logging
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isValid → bool
-
Checks if the configuration is valid
no setter
- networkTimeout → Duration
-
Timeout for network requests (defaults to 30 seconds)
final
- redirectScheme → String
-
Custom URL scheme for redirect (e.g., 'myapp')
final
- redirectUri → String
-
Gets the redirect URI for OAuth2 flow
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ List<
String> -
OAuth2 scopes to request
final
- scopeString → String
-
Gets the scopes as a space-separated string
no setter
- storageType → StorageType
-
Storage type for tokens and user data
final
- tokenEndpoint → String
-
Gets the token endpoint URL
no setter
- tokenRefreshThreshold → Duration
-
How long before expiration to refresh tokens (defaults to 5 minutes)
final
- userInfoEndpoint → String
-
Gets the user info endpoint URL
no setter
Methods
-
copyWith(
{String? baseUrl, String? clientId, String? redirectScheme, List< String> ? scopes, Duration? tokenRefreshThreshold, bool? autoRefresh, StorageType? storageType, String? customAuthorizationEndpoint, String? customTokenEndpoint, String? customUserInfoEndpoint, Map<String, String> ? additionalAuthParams, Duration? networkTimeout, bool? enableLogging}) → OAuthConfig - Creates a copy of this OAuthConfig with updated fields
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts OAuthConfig to JSON
-
toString(
) → String -
A string representation of this object.
override
-
validate(
) → List< String> - Validates the configuration and returns a list of issues
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override