문제

I want to extend HandleErrorAttribute to globally handle a custom error type in my project. This what I was envisioning

  • Page user makes a request to pull a report from the site
  • The site (mvc project) needs to talk to a web api using an auth token
  • The api returns 401 with a body that contains an app code indicated it was because the token has expired
  • The site sees this and throws a TokenRefreshException
  • The site handles this globally by retrieving the refresh token from the session and using it to update the user's tokens, save it back to the session and then reattempt the action.
  • If it isn't able to refresh the token, it kills the session and redirects the user to the login page.

Is this possible and how do I implement this logic without creating an infinite loop (I'm not sure how to keep count)?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top