logout method

Future<void> logout()

Ends the session: attempts RP-initiated logout if OneIdAuthConfig.endSessionEndpoint is configured, then always clears local token storage regardless of whether that call succeeds.

Implementation

Future<void> logout() async {
  final tokens = await _storage.read();
  try {
    await guardPlatformCall(
      () => _hostApi.endSession(_toMessage(config), tokens?.idToken),
    );
  } finally {
    await _storage.clear();
  }
}