Authenticator class
A wrapper around Flow that handles authentication in a non-web environment.
This authenticator uses a local http server to listen for the redirect from the authorization server. The server is started when the authorize method is called and stopped when the cancel method is called or when the authentication flow is completed.
Some authorization servers might not allow to redirect to a local http server. In that case, you should capture the authentication response in a different way and pass it to the processResult method.
Constructors
-
Authenticator(Client client, {int port = 3000, dynamic urlLancher(String url) = _runBrowser, Iterable<
String> scopes = const [], Uri? redirectUri, String? redirectMessage, String? prompt, Map<String, String> ? additionalParameters, String? htmlPage}) -
Creates an authenticator that uses a Flow.authorizationCodeWithPKCE flow
when
redirectUri
is null and a Flow.authorizationCode flow otherwise. - Authenticator.fromFlow(Flow flow, {dynamic urlLancher(String url)?, String? redirectMessage, String? htmlPage})
-
Creates an authenticator that uses the given
flow
.
Properties
- flow → Flow
-
The Flow used for authentication.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- htmlPage → String?
-
The html content to display when the authentication flow is completed.
final
- port → int
-
The port used by the local http server.
final
- redirectMessage → String?
-
The text message to display when the authentication flow is completed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- urlLancher → dynamic Function(String url)
-
final
Methods
- Starts the authentication flow.
-
cancel(
) → Future< void> - Cancels the authentication flow.
-
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
Static Methods
-
processResult(
Map< String, String> result) → Future<void> - Processes the result from an authentication flow.