cancel method

Future<void> cancel()

Cancels the authentication flow.

This method will stop the local http server and complete the authorize method with an error.

This method should be called when the user cancels the authentication flow in the browser.

Implementation

Future<void> cancel() async {
  final state = flow.authenticationUri.queryParameters['state'];
  _requestsByState[state!]?.completeError(Exception('Flow was cancelled'));
  final server = await _requestServers.remove(port);
  await server?.close();
}