logout method

Future<void> logout()

Log out of this CARP service using a BuildContext, that opens a web view to clear cookies and end the sesion on the Identity Server.

Use this if you used authenticate to authenticate.

The discovery URL is used to find the Identity Server.

Implementation

Future<void> logout() async {
  await appAuth.endSession(
    EndSessionRequest(
      discoveryUrl: "${app.discoveryURL}",
      idTokenHint: currentUser.token!.idToken,
      postLogoutRedirectUrl: "${app.logoutRedirectURI ?? app.redirectURI}",
    ),
  );

  _currentUser = null;
}