HTMLEditor with authentication gives 401

I can't seem to get this to work.
I tried with creating a new Blazor app (.net 5 and .net 3.1) from scratch, choosing Authentication and Individual User Accounts.
After that I have imported the Radzen Blazor from nuget and followed the instructions on your page to set it up.

But I can't get it to work. It always replies with 401 even though I have logged in. I have tested with Edge the chromium based version and FireFox.
It still might be my fault but I can't seem to see what I am missing in that case.

I've attached the .net 5 project:
BlazorAppRadzen.zip (227.6 KB)

The Bearer token seems to be missing when calling the upload controller from UploadUrl.

Hi @fnils,

Indeed the editor does not pass any HTTP headers during upload. We will add support for custom HTTP headers similar to the one already available in the Upload component.

1 Like

Do we know when this will be implemented?

It has been implemented a while ago.

1 Like

I am not sure I understand how the token part works.
I tried adding the token like I understood it in the Upload controller.

<RadzenUploadHeader Name="Authorization" Value="@token" />
<RadzenUploadHeader Name="X-Uploaded-By" Value="Radzen" />

code {
string token = "Bearer 2134kjfdsaas98324mn324lkufd";
}

Hi @RobertKazimirski,

You need to use the UploadHeaders parameter of RadzenHtmlEditor

<RadzenHtmlEditor 
    UploadHeaders="@(new Dictionary<string, string> { { "Authorization", $"Bearer {accesToken}" } })">