Document SignalR JavaScript client authentication refresh handler contexts and surface the feature in the JavaScript client article - #37696
Draft
wadepickett with Copilot wants to merge 3 commits into
Draft
wadepickett with Copilot wants to merge 3 commits into
wadepickett with Copilot wants to merge 3 commits into
Conversation
…texts and add discoverability section Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update SignalR TypeScript client to support authentication refresh
Document SignalR JavaScript client authentication refresh handler contexts and surface the feature in the JavaScript client article
Sep 20, 2026
ellisonantoniafelicia-star
approved these changes
Sep 21, 2026
|
|
||
| ## Authenticate users connecting to a SignalR hub | ||
|
|
||
| SignalR can be used with [ASP.NET Core authentication](xref:security/authentication/identity) to associate a user with each connection. In a hub, authentication data can be accessed from the <xref:Microsoft.AspNetCore.SignalR.HubConnectionContext.User?displayProperty=nameWithType> property. Authentication allows the hub to call methods on all connections associated with a user. For more information, see [Manage users and groups in SignalR](xref:signalr/groups). Multiple connections can be associated with a single user. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The .NET 11 authentication refresh APIs for the
@microsoft/signalrclient are already documented accurately in the Refresh authentication from the JavaScript client subsection of xref:signalr/authn-and-authz, so that content is left unchanged. Two gaps remain: the canonical JavaScript client article never mentions the feature, and the existing subsection usescontext.newTokenLifetimeInSecondsandcontext.errorin examples without stating what the handler contexts expose or what makes a refresh fail.aspnetcore/signalr/javascript-client.md— discoverability## Refresh authentication without reconnectingsection at the end of the body, before Related content.>= aspnetcore-6.0zone, so that zone is closed, a>= aspnetcore-11.0zone is opened for the new section, and the original zone is reopened with an identical range expression (openers/closers go from 2/2 to 4/4).<xref:signalr/authn-and-authz#authentication-refresh>rather than duplicating the ~35 lines that already exist there — the authentication article remains the home for the server half that must be configured first.aspnetcore/signalr/authn-and-authz.md— handler contract>= aspnetcore-11.0zone, after theIAuthenticationRefreshOptionslist.onAuthenticationRefreshedcontext members (connection,newTokenLifetimeInSeconds,refreshedAt) and theonAuthenticationRefreshFailedmembers (connection,error).OnAuthenticationRefreshrejects — a policy outcome that warrants different UI handling than a transport error. A failed refresh doesn't close the connection on its own and isn't retried automatically; the connection runs on existing credentials until expiration, then closes ifCloseOnAuthenticationExpirationis enabled.Metadata
ms.dateupdated on both articles;ai-usage: ai-assistedadded tojavascript-client.md.Verification
Each new statement was checked against product source at
dotnet/aspnetcore@1fcd7ef:IAuthenticationRefreshOptions.ts(context shapes),HubConnection.ts(context construction, handlers fire on manual refresh, no reschedule and no close on failure),HttpConnection.ts(statusCode !== 200),AccessTokenHttpClient.ts(refresh re-invokesaccessTokenFactory),HubConnectionBuilder.ts(options = {}, so the no-argument call above is valid),HttpConnectionDispatcher.cs(403 on rejection).Open for reviewer judgment
accessTokenFactorycan refresh is not asserted — no product test was found covering it.