File Upload, save api returns 401

We have a upload api running on http://localhost:8080
When the angular app running in development mode, i.e. http://localhost:5200, the uploader calls the API with 401 error.

I found the http request does not includes the cookies and may caused this issue.

If we build the angular and run it as the single webapp in together the api, i.e. everything in https://localhost:8080, then there is no issue.
CORS are all set. Could you advise anything missing?

]

1 Reply 1 reply marked as answer

SN Sevvandhi Nagulan Syncfusion Team September 16, 2020 11:18 AM UTC

Hi Raymond, 


Greetings from Syncfusion support. 


We checked the reported requirement. The reported problem may occur because cors not configured server-side application. Can you please check if the configuration below has been added to the application?. If not, then we suggest adding the configuration below to the file Startup.cs


[Startup.cs] 

public void ConfigureServices(IServiceCollection services)  
        {  
            services.AddMvc(option => option.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_3_0);  
            services.AddRazorPages();  
            services.AddCors(options =>  
            {  
                options.AddPolicy("AllowAllOrigins", builder =>  
                {  
                    builder.AllowAnyOrigin()  
                    .AllowAnyMethod()  
                    .AllowAnyHeader();  
                });  
            });  
  
            services.AddServerSideBlazor();  
            services.AddSyncfusionBlazor();  
            services.AddSingleton<WeatherForecastService>();  
        }  
  
            app.UseRouting();  
            app.UseCors("AllowAllOrigins");  
            app.UseMvcWithDefaultRoute();  
  


Kindly check the above suggestion and get back to us if you need any other further assistance. 

Regards, 
Sevvandhi N 


Marked as answer
Loader.
Up arrow icon