FTAuth class

The main utility class. It is generally not necessary to work with this class directly.

Implemented types

Constructors

FTAuth(Config config, {StorageRepo? storageRepo, AuthorizerInterface? authorizer, Client? baseClient, Duration? timeout, Uint8List? encryptionKey, SetupHandler? setup, bool? clearOnFreshInstall, ConfigChangeStrategy configChangeStrategy = ConfigChangeStrategy.ignore})

Properties

authorizer AuthorizerInterface
latefinal
authStates Stream<AuthState>
Returns the stream of authorization states.
no setteroverride
config Config
final
currentState AuthState
The current authorization state.
no setteroverride
currentUser User?
Retrieves the currently logged in user.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isLoggedIn bool
Whether or not a user is currently logged in.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

authorize({String? language, String? countryCode}) Future<String>
Initiates the authorization code flow.
override
close() → void
Closes the client and cleans up any resources associated with it.
inherited
delete(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP DELETE request with the given headers to the given URL.
inherited
exchange(Map<String, String> parameters) Future<Client>
Performs the second part of the authorization code flow, exhanging the parameters retrieved via the WebView with the OAuth server for an access and refresh token.
override
get(Uri url, {Map<String, String>? headers}) Future<Response>
Sends an HTTP GET request with the given headers to the given URL.
inherited
Sends an HTTP HEAD request with the given headers to the given URL.
inherited
init() Future<void>
Initializes the SDK. Must be called before performing any activities.
override
isPinning(String host) bool
Returns true if the repository is currently pinning for host.
override
launchUrl(String url) Future<void>
Launches the given URL.
override
login({String? language, String? countryCode}) Future<void>
Performs the full two-step OAuth process.
override
logout({bool deinit = false}) Future<void>
Logs out the current user.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PATCH request with the given headers and body to the given URL.
inherited
pinCert(Certificate certificate) → void
Creates a strict pinning to the given certificate for a particular host.
override
post(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP POST request with the given headers and body to the given URL.
inherited
put(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PUT request with the given headers and body to the given URL.
inherited
read(Uri url, {Map<String, String>? headers}) Future<String>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a String.
inherited
readBytes(Uri url, {Map<String, String>? headers}) Future<Uint8List>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a list of bytes.
inherited
refreshAuthState() Future<void>
Pull the latest auth state from the keychain. If, for example, an app extension or another window changed it, we may not have the latest.
override
send(BaseRequest request) Future<StreamedResponse>
Sends an HTTP request and asynchronously returns the response.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

logger LoggerInterface
Override this value to set the logger for the SSO module.
getter/setter pair

Static Methods

debug(String log) → void
error(String log) → void
info(String log) → void
retrieveDemoConfig({required Uri redirectUri, String? name, ClientType type = ClientType.public, String username = 'test', String password = 'test', Client? httpClient}) Future<Config>
Creates a temporary client configuration on the hosted FTAuth Demo server (https://demo.ftauth.io). A single user is created with login username and password.
warn(String log) → void