diff --git a/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs b/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs index bf7e9bfe5..2c86f0fa7 100644 --- a/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs +++ b/src/Business/Grand.Business.Authentication/Services/ApiAuthenticationService.cs @@ -3,6 +3,8 @@ using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure.Configuration; +using Grand.SharedKernel.Attributes; +using Grand.SharedKernel.Extensions; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; @@ -61,8 +63,8 @@ private bool IsApiFrontAuthenticated() var endpoint = _httpContextAccessor.HttpContext.GetEndpoint(); if (endpoint == null) return false; - var authorizeAttributes = endpoint.Metadata.GetOrderedMetadata(); - return authorizeAttributes.Any(attr => attr.AuthenticationSchemes?.Contains(FrontendAPIConfig.AuthenticationScheme) == true); + var apiGroupAttr = endpoint.Metadata.GetOrderedMetadata(); + return apiGroupAttr.Any(attr => attr.GroupName == ApiConstants.ApiGroupNameV2); }