exceptionWe have problem to get https://abp.io/docs/latest/framework/ui/blazor/authorization to work in our Blazor project. This is what we have:
@page "/"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize("CustomerService.Customers")]
@inherits MyProjectComponentBase
@* https://abp.io/docs/latest/framework/ui/blazor/authorization *@
#AuthorizeView Policy="CustomerService.Customers.Create">
    <p>You can only see this if you satisfy the "CustomerService.Customers.Create" policy.</p>
#/AuthorizeView>
The #  is instead of < since CB does render it? A bug in the Write component maybe?
This is the MyProject_Administration database, AbpPermissions table:

5 Answer(s)
- 
    0- The error - The AuthorizationPolicy named: 'CustomerService.Customers' was not found.indicates that you are using ASP.NET Core's policy-based authorization, but you have not registered a policy named- CustomerService.Customersin your application's authorization configuration.
- In ABP Blazor applications, permissions are typically checked using the ABP permission system, not by defining custom ASP.NET Core authorization policies for each permission. The correct way to check for a permission in a Blazor component is to use the - @attribute [Authorize]without a policy name, or to use the- AbpAuthorizeViewcomponent for permission checks.
- To check for a specific permission, use the ABP permission name in the - AbpAuthorizeViewcomponent, like this:
 @page "/" @using Volo.Abp.AspNetCore.Components.Authorization @attribute [Authorize] <!-- This just requires authentication --> <AbpAuthorizeView Permission="CustomerService.Customers.Create"> <p>You can only see this if you have the 'CustomerService.Customers.Create' permission.</p> </AbpAuthorizeView>- If you want to use the standard AuthorizeView, you must define the policy in yourStartup.csorProgram.cs:
 services.AddAuthorization(options => { options.AddPolicy("CustomerService.Customers", policy => policy.RequireClaim("Permission", "CustomerService.Customers")); });But this is not the recommended ABP way. - Make sure you are using the correct ABP permission system and components for permission checks in Blazor.
 Sources: - https://abp.io/docs/latest/framework/ui/blazor/authorization
 
 This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon. 
- 
    0Thanks AI, I tried your suggestion but it did not worked, I think that @using Volo.Abp.AspNetCore.Components.Authorization is not valid. Please let the humans take a look at it :-) 
- 
    0hi What is your project type? Microservice? Does your blazor project reference the Contractsproject that defines thePermissionDefinitionProvider?Thanks. 
- 
    0Thanks mailing, that was the problem! You need to copy the contracts into the blazor project. 
- 
    0: ) 

 
                                