C
C#14mo ago
honk

❔ Force log out the user after account deletion with JWT bearer auth.

Hello, I'm working on adding a feature that allows administrators to delete users. As things currently stand, when a user is deleted, their account is successfully removed, but their JWT token remains in the browser, allowing them to still access most of the website without any issues. I've come up with a few possible solutions, such as regularly checking from the frontend using an API call or websockets to see if the user has been deleted or not. However, I would prefer to use a built-in functionality if available. I came across SecurityStampValidationOptions, but it doesn't seem to work when I tried using it after AddIdentity with services.Configure<>. Is there a simpler way to achieve this?
4 Replies
atakancracker
atakancracker14mo ago
I am not sure its possible to delete token on the client from server without connection (other than changing the token secret but it will invalidate all tokens) centeralized caching like Redis for storing user status whether its deleted or not and control it on each request. If its deleted state then return some custom http response which clears the JWT on client. Thats what comes in my mind first
honk
honk14mo ago
Thanks, will look into it!
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
✅ I updated to .NET 8 and now it broke...Hello i thought about .NET 8 and it has very usefull features so i want to update to it but sadly wh✅ Compiling ASP.NET 7 app using Github ActionsI am trying to compile my ASP.NET 7 application solution using Github actions but am getting the fol❔ How to handle a group of variables that need to stay together within a class?How should I handle a group of data that needs to stay together within a class? The data is a set of❔ .NET MAUI MVVM Navigation and pass Object to new page, Throw Exception: Missing methodProgram crash after this code ```[RelayCommand] async Task GoApartmentDetail(Apartment apart❔ .NET Maui Blazor: Render a Website inside the Application and get its cookies.Hello, how can I have a Webview inside the Application itself? It cannot be an iframe since I need t❔ run code on serverhow to run c# code on server...is vps is needed or simple hosting...which server is best in ur view❔ WPF Canvas starts getting choppy and laggy after drawing a long lineHello, I am making an application with a feature that lets you draw on the screen, however after dra❔ Camera Control with arrow key in Unity Engine doesn't work❔ Way to use PostMessage as mouse click without switching current foreground windowCurrently using `PostMessage(hTargetWindow, mapping, ti.wParam, ti.lParam)`, the target window recei✅ a class implementing a generic interface with more than one interface as one generic type argumentI'm making a serializer (not for JSON), trying hard to use generics ~~and trimmable methods~~ wherev