I'm trying to setup Rich Text Editor SaverUrl parameter to enable image support. I place the method on a api service that uses app.UseCors, app.UseAuthentication, and app.UseAuthorization. When I try to upload a image, I get the response 401 Unauthorized back. I've tried to use the BeforeUploadImage event, but couldn't find a way to send UseDefaultCredentials with the request or set the client the control is using. Please help on how to accomplish sending the default credentials.
|
@using Syncfusion.Blazor.RichTextEditor <SfRichTextEditor> <RichTextEditorEvents BeforeUploadImage="BeforeUpload"></RichTextEditorEvents> <RichTextEditorImageSettings SaveUrl="api/Image/Save" Path="./Files/" /> Syncfusion Rich Text Editor </SfRichTextEditor> <br/> @code { public void BeforeUpload(ImageUploadingEventArgs args) { // Adding Headers args.CurrentRequest = new List<object> { new { Authorization = "Syncfusion Test" } }; // adding custom Form Data args.CustomFormData = new List<object> { new { page = "Testing" } }; } } |
I have read that article but it doesn't indicate how to send the authorization. The line of code for the current request, doesn't show how to send UseDefaultCredentials authorization.
To provide more detail, the preflight request is failing because user credentials are not sent with the request. Since SaveUrl method only accepts a string, there is no way to set UseDefaultCredentials = true for the httpclient it uses.
|
private void onFileSelect(SelectedEventArgs args)
{
var accessToken = "Basic test123";
args.CurrentRequest = new List<object> { new { Authorization = accessToken } };
} |
|
var auth = Request.Headers["Authorization"]; |