Blazor Web App NET 8-Pass Access Token to SignalR Endpoint
My Blazor backend app uses a custom AuthenticationStateProvider which persists the authenticated user on both the backend app and the web assembly client app. I can use a BaseAddressAuthorizationMessageHandler when registering an http client which will attach my access token to header, however the SignalR JavaScript client uses WebSockets and I have to attach the access token to the query string. How do I get the access token in a razor component inside my web assembly client app? The cascaded parameter AuthenticationState, HttpContext or the HttpContextAcessor objects do not have it and I read it’s not even safe to use the HttpConext in a razor component. the MS documentation here: blazor8 doesn’t help. This is where I’m stuck: