I am using the RequestRetrier
of Alamofire 4.0 to control the retrying of requests for expired access token. I am following the documentation here.
I have a very similar implementation to the example available in the documentation OAuth2Handler
which implements RequestAdapter
and RequestRetrier
.
The issue I am encountering is that func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion)
is never being called. The adapt
method of the RequestAdapter
implementation does get called though.
Debugging, I see that SessionDelegate
only calls should(_,retry,with,completion)
when there is an error, but requests that return status codes related to Authorization issues, don't seem to generate errors, so that method never gets called.
Am I missing something here?