start method

Future<void> start([
  1. AuthClientLoginOptions? options
])

Implementation

Future<void> start([AuthClientLoginOptions? options]) async {
  if (useLocalPage) {
    var originUrl = authUri;
    key ??= Ed25519KeyIdentity.generate(null);
    var page = generateHtml(
        sessionPublicKey: key!.getPublicKey().toDer().toHex(),
        callbackPath: path,
        callbackScheme: scheme,
        authUri: originUrl);
    server = await startServer(page, port);
    authUri = Uri.parse('http://localtest.me:32768');
    try {
      await login(options);
    } catch (e) {
      server?.close(force: true);
      rethrow;
    }
    server?.close(force: true);
  } else {
    await login(options);
    server?.close(force: true);
  }
}