im trying to get the role claim and verify the it before adding a new user
var role = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Role).Value;
i have already registered service in programs.cs
builder.Services.AddHttpContextAccessor();
and initialized well
private readonly IHttpContextAccessor _httpContextAccessor;
public DBService(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
Any help would be much appreciated!