Gems/AWSClientAuth/Code/Source/UserManagement/AWSCognitoUserManagementController.cpp
void AWSCognitoUserManagementController::ConfirmSignUpAsync(const AZStd::string& username, const AZStd::string& confirmationCode)
    {
        std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> cognitoIdentityProviderClient =
            AZ::Interface<IAWSClientAuthRequests>::Get()->GetCognitoIDPClient();
 
        AZ::JobContext* jobContext = nullptr;
        AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);

        AZ::Job* confirmSignUpJob = AZ::CreateJobFunction([this, cognitoIdentityProviderClient, username, confirmationCode]()
        {
            Aws::CognitoIdentityProvider::Model::ConfirmSignUpRequest confirmSignupRequest;
            confirmSignupRequest.SetClientId(m_cognitoAppClientId.c_str());
            confirmSignupRequest.SetUsername(username.c_str());
            confirmSignupRequest.SetConfirmationCode(confirmationCode.c_str());

            Aws::CognitoIdentityProvider::Model::ConfirmSignUpOutcome confirmSignupOutcome{ cognitoIdentityProviderClient->ConfirmSignUp(confirmSignupRequest) };
            if (confirmSignupOutcome.IsSuccess())
            {
                AWSCognitoUserManagementNotificationBus::Broadcast(&AWSCognitoUserManagementNotifications::OnConfirmSignUpSuccess);
            }
            else
            {
                Aws::Client::AWSError<Aws::CognitoIdentityProvider::CognitoIdentityProviderErrors> error = confirmSignupOutcome.GetError();
                AWSCognitoUserManagementNotificationBus::Broadcast(&AWSCognitoUserManagementNotifications::OnConfirmSignUpFail, error.GetMessage().c_str());
            }
        }, true, jobContext);
        confirmSignUpJob->Start();
    }
// Call Cognito user pool confirm sign up using code from email/phone.
// Refer https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html
Call Cognito user pool confirm sign up using code from email/phone.
Call Cognito user pool confirm sign up using code from email / phone .
void AWSCognitoUserManagementController::ConfirmSignUpAsync(const AZStd::string& username, const AZStd::string& confirmationCode)
    {
        std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> cognitoIdentityProviderClient =
            AZ::Interface<IAWSClientAuthRequests>::Get()->GetCognitoIDPClient();
        AZ::JobContext* jobContext = nullptr;
        AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext);
        AZ::Job* confirmSignUpJob = AZ::CreateJobFunction([this, cognitoIdentityProviderClient, username, confirmationCode]()
        {
            Aws::CognitoIdentityProvider::Model::ConfirmSignUpRequest confirmSignupRequest;
            confirmSignupRequest.SetClientId(m_cognitoAppClientId.c_str());
            confirmSignupRequest.SetUsername(username.c_str());
            confirmSignupRequest.SetConfirmationCode(confirmationCode.c_str());
            Aws::CognitoIdentityProvider::Model::ConfirmSignUpOutcome confirmSignupOutcome{ cognitoIdentityProviderClient->ConfirmSignUp(confirmSignupRequest) };
            if (confirmSignupOutcome.IsSuccess())
            {
                AWSCognitoUserManagementNotificationBus::Broadcast(&AWSCognitoUserManagementNotifications::OnConfirmSignUpSuccess);
            }
            else
            {
                Aws::Client::AWSError<Aws::CognitoIdentityProvider::CognitoIdentityProviderErrors> error = confirmSignupOutcome.GetError();
                AWSCognitoUserManagementNotificationBus::Broadcast(&AWSCognitoUserManagementNotifications::OnConfirmSignUpFail, error.GetMessage().c_str());
            }
        }, true, jobContext);
        confirmSignUpJob->Start();
    }
void AWSCognitoUserManagementController :: ConfirmSignUpAsync ( const AZStd :: string & username , const AZStd :: string & confirmationCode ) { std :: shared_ptr < Aws :: CognitoIdentityProvider :: CognitoIdentityProviderClient > cognitoIdentityProviderClient = AZ :: Interface < IAWSClientAuthRequests > :: Get ( ) -> GetCognitoIDPClient ( ) ; AZ :: JobContext * jobContext = nullptr ; AWSCore :: AWSCoreRequestBus :: BroadcastResult ( jobContext , & AWSCore :: AWSCoreRequests :: GetDefaultJobContext ) ; AZ :: Job * confirmSignUpJob = AZ :: CreateJobFunction ( [ this , cognitoIdentityProviderClient , username , confirmationCode ] ( ) { Aws :: CognitoIdentityProvider :: Model :: ConfirmSignUpRequest confirmSignupRequest ; confirmSignupRequest . SetClientId ( m_cognitoAppClientId . c_str ( ) ) ; confirmSignupRequest . SetUsername ( username . c_str ( ) ) ; confirmSignupRequest . SetConfirmationCode ( confirmationCode . c_str ( ) ) ; Aws :: CognitoIdentityProvider :: Model :: ConfirmSignUpOutcome confirmSignupOutcome { cognitoIdentityProviderClient -> ConfirmSignUp ( confirmSignupRequest ) } ; if ( confirmSignupOutcome . IsSuccess ( ) ) { AWSCognitoUserManagementNotificationBus :: Broadcast ( & AWSCognitoUserManagementNotifications :: OnConfirmSignUpSuccess ) ; } else { Aws :: Client :: AWSError < Aws :: CognitoIdentityProvider :: CognitoIdentityProviderErrors > error = confirmSignupOutcome . GetError ( ) ; AWSCognitoUserManagementNotificationBus :: Broadcast ( & AWSCognitoUserManagementNotifications :: OnConfirmSignUpFail , error . GetMessage ( ) . c_str ( ) ) ; } } , true , jobContext ) ; confirmSignUpJob -> Start ( ) ; }
Call Cognito user pool confirm sign up using code from email/phone.
Call Cognito user pool confirm sign up using code from email / phone .