Method GetSessionTokenAsync
GetSessionTokenAsync<TSessionToken>(HubCallerContext, SessionAccessOptions)
Gets the session token for the hub connection. If the user is not signed in, returns null.
Declaration
public static ValueTask<TSessionToken?> GetSessionTokenAsync<TSessionToken>(this HubCallerContext context, SessionAccessOptions sessionOptions = SessionAccessOptions.None) where TSessionToken : class, ISessionToken
Parameters
| Type | Name | Description |
|---|---|---|
| HubCallerContext | context | The hub caller context. |
| SessionAccessOptions | sessionOptions | Option flags for retrieving the session token. |
Returns
| Type | Description |
|---|---|
| ValueTask<TSessionToken> |
Type Parameters
| Name | Description |
|---|---|
| TSessionToken |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The hub connection does not have an HTTP context. |