Is there a way to deal with 401
and refresh token using AFNetwork 2.0
in a centralized way?
I'm able to solve the problem with my on implementation of AFHTTPSessionManager
.
I did overriding the dataTaskWithRequest:completionHandler:
method to retry the same request after getting a new access token.
But if I do that I'm unable to cancel the original request 'cause we're creating new ones.
My question is, could we create a new request encapsulating the new one inside the original so I could cancel the request and also canceling all the retry logic?