Authenticator constructor
Authenticator(})
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/');