Description
As already requested by
it would be a nice Feature if RestSharp Handles the JWT Access- and RefreshToken.
In the current Implementation, a Authenticator Implementation is not able to Refresh the JWTTokenPair,
if the AccessToken is going to exceed runtime.
Because to Refresh The Token Pair, the Authenticator would need a to perform a RestRequest to the Server and therefor a RestClient.
But neither the DI neither a user can provide the RestClient, because to Construct a RestClient, we need to set the Authenticator.
This leads to a Circular Dependency, which is not solveable.
A possibility would be to Create another RestClient, for the Authenticator, but I don't think this would be a clean solution to the problem.
Another solution is to use the Interceptor Pattern Implementation, as provided in the PullRequest, bellow, because the Interceptors are provided inside a List, they can be changed even after the RestClient have been created.
As I think the Authenticator is a special form of the Interceptor Pattern, therefor this solution fits in mine optionion.
Additionally, I would say it's not unusual to allow adding Interceptors at any time.