Logout Override in Custom Provider is Not Called

I have a custom AuthProvider which puts login session data to the database on successful authenticate. When the user logs out (we do an /auth/logout) we’re supposed to update the Login info that was previously stored as no longer valid or remove it. Unfortunately, the overridden Logout in the provider is never called so when I go to authenticate again (same or different user), I’m in a half-logged in state per the workflow and can’t log the person in correctly.

What should I be doing to ensure that my overridden Logout is called (which will then call the base.Logout(…) after it’s done doing what it needs to do).

The logout action is only called on the first registered AuthProvider, so you can either move your custom AuthProvider so it’s the first 1 registered in the AuthFeature plugin, otherwise you can handle Logout’s with the OnLogout() Session or AuthEvent.

1 Like