I am creating Android and IoS apps.
I use refit for calling the WebAPI.
The WebAPI need bearer authorization.
But i think that is bad to pass the token every request.
I found to do that in the GitHub, but i don't know how to use refit settings in xamarin forms.
I need to Set either AuthorizationHeaderValueGetter
or AuthorizationHeaderValueWithParamGetter
in the RefitSettings
instance.
Can someone help me ? please
var ApiRefit = RestService.For<IApiRefit>("URL", new RefitSettings
{
AuthorizationHeaderValueGetter = async () => await GetTokenAsync()
});
[Headers("User-Agent: Your App", "Authorization: Bearer")]
public interface IApiRefit
{
.........
}