Rest Basic HTTP Authentication Missing

I am just trying to test out connecting to a REST API. All the documentation shows basic authentication as an option, however I only have "None", "OAuth" and "Azure AD" listed as options. Is there something I am missing or was basic authentication removed?

Hi @lwh,

Welcome to the Radzen community!

Indeed the Radzen Blazor REST support does not include HTTP Basic authentication at the moment. You can however add that relatively easily by adding a partial class for the generated service and specifying a method that sets the Authorization HTTP header.


public partial class MyRestService
{
     public partial void OnMyRestServiceMethod(HttpRequestMessage requestMessage)
     {
         var authenticationString = $"{user}:{password}";
         var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(authenticationString));

        requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Basic", base64EncodedAuthenticationString);
     }
}