I have a web API in .net core 1.0 that issues a JWT token (access_token) to clients upon login. Now the token has a short validity period (10 minutes), and the client requests a new token every 8 minutes for a continuous session. This token is stored in a cookie in a browser on the client side. Now it works great if the client only works on one browser tab. However, if the client opens two or more tabs, each 8-minute request for a new token arrives in the API. This leads to several requests of the same user at the same time, and the token for my request processes each request, but only one of the tokens is stored in the cookie on the client side. But this leads to a multiple token, of which only one is used throughout its entire life cycle.
I tried to store the user ID and token in the database and cross-check them during the API request, however the same user on several tabs makes a simultaneous request, and the logic does not work here.
How can I solve this situation? I want my API to issue only one token for each user open on multiple tabs. Any help is appreciated.
source share