Authenticator constructor

Authenticator(
  1. Client client, {
  2. int port = 3000,
  3. dynamic urlLancher(
    1. String url
    ) = _runBrowser,
  4. Iterable<String> scopes = const [],
  5. Uri? redirectUri,
  6. String? redirectMessage,
  7. String? prompt,
  8. Map<String, String>? additionalParameters,
  9. String? htmlPage,
})

Creates an authenticator that uses a Flow.authorizationCodeWithPKCE flow when redirectUri is null and a Flow.authorizationCode flow otherwise.

Implementation

Authenticator(
  Client client, {
  this.port = 3000,
  this.urlLancher = _runBrowser,
  Iterable<String> scopes = const [],
  Uri? redirectUri,
  String? redirectMessage,
  String? prompt,
  Map<String, String>? additionalParameters,
  this.htmlPage,
})  : assert(
        htmlPage != null ? redirectMessage == null : true,
        'You can only use one variable htmlPage (give entire html) or redirectMessage (only string message)',
      ),
      redirectMessage = redirectMessage ?? 'You can now close this window',
      flow = redirectUri == null
          ? Flow.authorizationCodeWithPKCE(client,
              prompt: prompt, additionalParameters: additionalParameters)
          : Flow.authorizationCode(client,
              prompt: prompt, additionalParameters: additionalParameters)
        ..scopes.addAll(scopes)
        ..redirectUri = redirectUri ?? Uri.parse('http://localhost:$port/');