There are multiple ways to enable authentication in Hot Chocolate. Here is simple approach:
Step 1 – Enable ASP.NET Core authentication
First step is to enable authentication at ASP.NET Core level. Let’s use JWT token for authentication:
Step 2- Enable authentication at the root GraphQL query
The second(and already the last step) is to enable authentication on the root query type. By providing no role or policy names we’re simply saying the user must be authenticated.