Hi guys I'm new to concept of refreshing token.
But I see it is a standard today.
I'm building a React/Node app and I see in a lot of articles like here, that we should send additional request to server to refresh token
Like here: https://medium.com/@monkov/react-using-axios-interceptor-for-token-refreshing-1477a4d5fc26
My Question is if we have middleware to check if access token is valid from cookie, why if token is invalid server returns 401 status, that access token is invalid, and then we send additional request from front to refresh token.
Why not check tokens from cookies in middleware, and refresh token also in middleware and return new tokens, and if both are invalid return 401 status, but in tutorials in they always send additional request for refresh token