Method SignInAsync
SignInAsync<TSessionToken>(SessionContext<TSessionToken>, string, string, bool, Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>>, CancellationToken)
Signs in the user of a one-time sign-in code: checks the request's origin with EnsureSignInOriginAllowed(), redeems the code with RedeemAsync(string, string, CancellationToken) and then signs in with SignInAsync(bool, Func<SignInInfo, Task<TSessionToken>>).
Declaration
public Task<TSessionToken> SignInAsync<TSessionToken>(SessionContext<TSessionToken> sessionContext, string code, string codeVerifier, bool persistent, Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>> createSessionFunc, CancellationToken cancellationToken = default) where TSessionToken : class, ISessionToken
Parameters
| Type | Name | Description |
|---|---|---|
| SessionContext<TSessionToken> | sessionContext | The session context of the current request. |
| string | code | The sign-in code. |
| string | codeVerifier | The PKCE code verifier that matches the challenge the code was created with. |
| bool | persistent | If set to true, the session will persist across browser or application restarts. |
| Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>> | createSessionFunc | A function that creates a new session for the user of the redeemed code (see RedeemedSignInCode, which also has the app's value the code was created with) based on the provided SignInInfo. It is only called if the code is valid. |
| CancellationToken | cancellationToken | A token to cancel redeeming the code. |
Returns
| Type | Description |
|---|---|
| Task<TSessionToken> |
Type Parameters
| Name | Description |
|---|---|
| TSessionToken |
Exceptions
| Type | Condition |
|---|---|
| UnauthorizedApiException | The code is unknown, expired or already used, or the code verifier does not match (SignInCodeInvalid). |
| ForbiddenApiException | The request's origin is not allowed (OriginBlocked). The code is not redeemed. |
SignInAsync<TSessionToken>(SessionContext<TSessionToken>, RedeemSignInCodeCommand, Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>>, CancellationToken)
Signs in the user of a one-time sign-in code with the values of a RedeemSignInCodeCommand: checks the request's origin with EnsureSignInOriginAllowed(), redeems the code with RedeemAsync(string, string, CancellationToken) and then signs in with SignInAsync(bool, Func<SignInInfo, Task<TSessionToken>>).
Declaration
public Task<TSessionToken> SignInAsync<TSessionToken>(SessionContext<TSessionToken> sessionContext, RedeemSignInCodeCommand command, Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>> createSessionFunc, CancellationToken cancellationToken = default) where TSessionToken : class, ISessionToken
Parameters
| Type | Name | Description |
|---|---|---|
| SessionContext<TSessionToken> | sessionContext | The session context of the current request. |
| RedeemSignInCodeCommand | command | The code, the code verifier and whether the session is persistent. |
| Func<RedeemedSignInCode, SignInInfo, Task<TSessionToken>> | createSessionFunc | A function that creates a new session for the user of the redeemed code (see RedeemedSignInCode, which also has the app's value the code was created with) based on the provided SignInInfo. It is only called if the code is valid. |
| CancellationToken | cancellationToken | A token to cancel redeeming the code. |
Returns
| Type | Description |
|---|---|
| Task<TSessionToken> |
Type Parameters
| Name | Description |
|---|---|
| TSessionToken |
Exceptions
| Type | Condition |
|---|---|
| UnauthorizedApiException | The code is unknown, expired or already used, or the code verifier does not match (SignInCodeInvalid). |
| ForbiddenApiException | The request's origin is not allowed (OriginBlocked). The code is not redeemed. |