-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Core 9 Web API Cookbook
By :
When building real-time applications with SignalR, a common challenge is maintaining user identity across both HTTP endpoints and WebSocket connections. How do we transfer a user’s identity from a normal REST HTTP controller login to a SignalR hub – in such a way that the user’s auth information can be used in real-time SignalR communication? In this recipe, we will start with a basic HTTP controller for user registration and login, then pass the authenticated user’s identity to a chat room application. We will accomplish this by using SignalR’s built-in ability to get a user identity from a JWT NameIdentifier claim.
The starter project for this recipe can be found here: https://github.com/PacktPublishing/ASP.NET-9-Web-API-Cookbook/tree/main/start/chapter06/JWTNameIdentifier.
Before starting, ensure you have a development certificate installed...