Add Bearer, Basic or Header Authentication for RestEase: the easy-to-use typesafe REST API client library.
$ dotnet add package RestEase.AuthenticationAn extension to RestEase which supports Bearer, Basic and ApiKey authentication.
Bearer-Authentication{
"DocumentApiClientOptions": {
"AuthenticationType": "Bearer",
"Value": "0418ee68-40b5-44a1-b092-aa26b888a7ca",
"BaseAddress": "https://localhost:44319"
}
}
Basic-Authentication{
"DocumentApiClientOptions": {
"AuthenticationType": "Basic",
"UserName": "u",
"Password": "p",
"BaseAddress": "https://localhost:44319"
}
}
Header-Authentication{
"DocumentApiClientOptions": {
"AuthenticationType": "Header",
"HeaderName": "X-API-KEY",
"Value": "0418ee68-40b5-44a1-b092-aa26b888a7ca",
"BaseAddress": "https://localhost:44319"
}
}
var section = configuration.GetSection("DocumentApiClientOptions");
services.UseWithAuthenticatedRestEaseClient<IDocumentApi>(section);
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of RestEase.Authentication.