Passing JWT from a SignalR Client

Learn to secure SignalR hub with the JWT middleware.

Unlike other communication technologies used by ASP.NET Core, SignalR can either use the OIDC authentication flow or a bearer token. The specific mechanism that SignalR will use will depend on the following factors:

  • It will use OIDC if the client is part of the UI that initiates the OIDC authentication flow and is hosted by the same web application as the SignalR hub.

  • It will use a bearer token if the client is hosted by a different application than the SignalR hub.

The following playground demonstrates how to configure security requirements for both authentication mechanisms:

Get hands-on with 1200+ tech skills courses.