src/AWSSDK.Extensions.CognitoAuthentication/CognitoUserAuthentication.cs
/// <summary>
/// Initiates the asynchronous custom authentication flow
/// </summary>
/// <param name="customRequest">InitiateCustomAuthRequest object containing the necessary parameters to
/// create an InitiateAuthAsync API call for custom authentication</param>
/// <returns>Returns the AuthFlowResponse object that can be used to respond to the next challenge, 
/// if one exists</returns>
Initiates the asynchronous custom authentication flow
Initiates the asynchronous custom authentication flow
public void StartWithCustomAuthAsync(InitiateCustomAuthRequest customRequest, AsyncCallback<AuthFlowResponse> callback = null)
        {
            InitiateAuthRequest authRequest = new InitiateAuthRequest()
            {
                AuthFlow = AuthFlowType.CUSTOM_AUTH,
                AuthParameters = new Dictionary<string, string>(customRequest.AuthParameters),
                ClientId = ClientID,
                ClientMetadata = new Dictionary<string, string>(customRequest.ClientMetadata)
            };
            Provider.InitiateAuthAsync(authRequest, r =>
            {
                if (r.Exception != null)
                {
                    callback?.Invoke(new AsyncResult<AuthFlowResponse>(null, r.Exception));
                    return;
                }
                InitiateAuthResponse initiateResponse = r.Response;
                UpdateUsernameAndSecretHash(initiateResponse.ChallengeParameters);
                UpdateSessionIfAuthenticationComplete(initiateResponse.ChallengeName, initiateResponse.AuthenticationResult);
                callback?.Invoke(new AsyncResult<AuthFlowResponse>(new AuthFlowResponse()
                {
                    SessionID = initiateResponse.Session,
                    ChallengeName = initiateResponse.ChallengeName,
                    AuthenticationResult = initiateResponse.AuthenticationResult,
                    ChallengeParameters = initiateResponse.ChallengeParameters,
                    ClientMetadata = new Dictionary<string, string>(initiateResponse.ResponseMetadata.Metadata)
                }, null));
            });
        }
public void StartWithCustomAuthAsync ( InitiateCustomAuthRequest customRequest , AsyncCallback < AuthFlowResponse > callback = null ) { InitiateAuthRequest authRequest = new InitiateAuthRequest ( ) { AuthFlow = AuthFlowType . CUSTOM_AUTH , AuthParameters = new Dictionary < string , string > ( customRequest . AuthParameters ) , ClientId = ClientID , ClientMetadata = new Dictionary < string , string > ( customRequest . ClientMetadata ) } ; Provider . InitiateAuthAsync ( authRequest , r => { if ( r . Exception != null ) { callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( null , r . Exception ) ) ; return ; } InitiateAuthResponse initiateResponse = r . Response ; UpdateUsernameAndSecretHash ( initiateResponse . ChallengeParameters ) ; UpdateSessionIfAuthenticationComplete ( initiateResponse . ChallengeName , initiateResponse . AuthenticationResult ) ; callback ? . Invoke ( new AsyncResult < AuthFlowResponse > ( new AuthFlowResponse ( ) { SessionID = initiateResponse . Session , ChallengeName = initiateResponse . ChallengeName , AuthenticationResult = initiateResponse . AuthenticationResult , ChallengeParameters = initiateResponse . ChallengeParameters , ClientMetadata = new Dictionary < string , string > ( initiateResponse . ResponseMetadata . Metadata ) } , null ) ) ; } ) ; }
Initiates the asynchronous custom authentication flow
Initiates the asynchronous custom authentication flow
Returns the AuthFlowResponse object that can be used to respond to the next challenge,
if one exists
Returns the AuthFlowResponse object that can be used to respond to the next challenge if one exists
customRequest
InitiateCustomAuthRequest
InitiateCustomAuthRequest object containing the necessary parameters to
create an InitiateAuthAsync API call for custom authentication
InitiateCustomAuthRequest object containing the necessary parameters to create an InitiateAuthAsync API call for custom authentication
callback
AsyncCallback<AuthFlowResponse>