Create a minimal API with JWT authentication

Hi, I want to build a minimal API with JWT authentication, how can i do it? The following code doesn’t work, it gives to me 403 error even with correct JWT code

public void Route_Action(IEndpointRouteBuilder app) {
    // Example:
    app.MapGet("/MyAction/{id}", (string id) => Results.Json(new { id = id })).RequireAuthorization("ApiUserLevel");
}

For API action, make sure that you have “/api” in your Route. See Route_Action example 3.