Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor changes - with api request (when is fail authenticate)

KrzysztofPajakacb68437f564
diff --git a/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs b/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs
index 39ed14b87..7591f7425 100644
--- a/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs
+++ b/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs
@@ -84,7 +84,12 @@ namespace Grand.Business.Authentication.Services
Customer customer = null;
var authResult = await _httpContextAccessor.HttpContext.AuthenticateAsync(GrandWebApiConfig.Scheme);
if (!authResult.Succeeded)
- return null;
+ {
+ _httpContextAccessor.HttpContext.Response.StatusCode = 400;
+ _httpContextAccessor.HttpContext.Response.ContentType = "text/plain";
+ await _httpContextAccessor.HttpContext.Response.WriteAsync(authResult.Failure.Message);
+ return await _customerService.GetCustomerBySystemName(SystemCustomerNames.Anonymous);
+ };
var email = authResult.Principal.Claims.ToList().FirstOrDefault(x => x.Type == "Email")?.Value;
if (email is null)