Open
Description
If I use a custom HttpClient and custom RefitSettings, the AuthorizationHeaderValueGetter gets ignored and GetTokenAsync() is never called.
RestService.For<IAccountsClient>(
new System.Net.Http.HttpClient()
{
BaseAddress = new Uri(apiIP + "Accounts"),
Timeout = timeout
}
, new RefitSettings()
{
AuthorizationHeaderValueGetter = () => GetTokenAsync()
});
This is the method in the Interface
[Headers("Authorization: Bearer")]
[Get("/EchoWithLogin")]
Task<string> EchoWithLoginAsync(string echoMessage);
Calling EchoWithLoginAsync does not add the token value to the header and the GetTokenAsync() method does not get called.
If insted I define the service as follows everything works fine, but I loose the timeout capability:
Accounts = RestService.For<IAccountsClient>(apiIP + "Accounts", new RefitSettings()
{
AuthorizationHeaderValueGetter = () => GetTokenAsync()
});