Method SignInAsync
SignInAsync(bool, Func<SignInInfo, Task<TSessionToken>>)
Signs in a user by creating a new session with the provided function and issuing the session cookie with the session token that the function returns.
The request's previous session, if it has one, is then ended with InvalidateSessionAsync(TSessionToken, CancellationToken), unless the
function returned its token (compared with Equals(Object, Object)). The response is marked with a
Session-Change: sign-in header, so that the toolkit's clients take its cookie whatever session the device has by then.
Declaration
public override Task<TSessionToken> SignInAsync(bool persistent, Func<SignInInfo, Task<TSessionToken>> createSessionFunc)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | persistent | If set to true, the session will persist across browser or application restarts. |
| Func<SignInInfo, Task<TSessionToken>> | createSessionFunc | A function that creates the session record with the values of the provided SignInInfo and returns the session token. Other values that creating the session needs, e.g. the user's ID, are captured by the function. |
Returns
| Type | Description |
|---|---|
| Task<TSessionToken> |
Overrides
Exceptions
| Type | Condition |
|---|---|
| ForbiddenApiException | The request's origin is not allowed (OriginBlocked). |