Method GetTokenAsync
GetTokenAsync(SessionAccessOptions)
Gets the session token from the current request. If the user is not signed in, returns null.
Declaration
public override ValueTask<TSessionToken?> GetTokenAsync(SessionAccessOptions sessionOptions = SessionAccessOptions.None)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionAccessOptions | sessionOptions | Option flags for retrieving the session token. |
Returns
| Type | Description |
|---|---|
| ValueTask<TSessionToken> |
Overrides
Remarks
The token is read from the request once and cached for subsequent calls. The session is validated against the session store when the cookie is due for a refresh, at most once per request, and on every call with ForceValidate, unless the token was set in the request. After SetToken(TSessionToken) or ClearToken() is called, subsequent calls return the token that was set (or null). The session context of a SignalR hub connection is the one of the request that established it, for the whole connection.