OidcShouldRemoveInvalidTokenCallback typedef

OidcShouldRemoveInvalidTokenCallback = bool? Function(OidcUser user, List<Exception> validationErrors)

The callback used by OidcUserManagerSettings.shouldRemoveInvalidToken to decide whether a loaded-but-invalid token is removed from the OidcStore.

Invoked in the discard branch of cached-token loading with the loaded user and its validationErrors.

Return:

  • true → remove the cached tokens from the store.
  • false → keep the cached tokens (e.g. for a bespoke offline policy).
  • null → apply the default policy, which removes the tokens unless OidcUserManagerSettings.supportOfflineAuth is enabled.

Implementation

typedef OidcShouldRemoveInvalidTokenCallback =
    bool? Function(OidcUser user, List<Exception> validationErrors);