Not sure what status to watch when authentication with MFA

This is for a VB.NET Client application - If MFA is turned off - with proper credentials I get “SUCCESS” once MFA is enabled again with proper userid/password - I get “MFA_REQUIRED”. once into that section of code … I do get a call and acknowledge in Okta Verify - “Yes it’s me” … but I never see that status change. Should I be watching some other status? Any example code?

    Dim authnResponse = oktaClient.AuthenticateAsync(authnOptions).Result
    Dim stateToken = authnResponse.StateToken
    Dim sessionToken = authnResponse.StateToken
    Console.WriteLine($"StateToken: {stateToken}")

    ' Check if MFA is required
    If authnResponse.AuthenticationStatus = "MFA_REQUIRED" Then

        ' MFA is required, check for available factors
        Dim allFactors As CastingListAdapter(Of Factor) = authnResponse.Embedded.GetArrayProperty(Of Factor)("factors")

        ' Find Okta Verify Push factor
        Dim oktaVerifyPushFactor = allFactors.FirstOrDefault(Function(f) f.Type.Contains("push"))

        Dim factorID = oktaVerifyPushFactor.Id
        ' Setup options for Activate Push Factor
        Dim ActivateFactorOptions = New ActivateFactorOptions() With {
            .StateToken = stateToken,
            .FactorId = factorID
        }
        ' Activate Okta Verify Push Factor
        Dim activateResponse = ActivateFactor(oktaClient, stateToken, factorID)

        ' Verify Okta Verify Push Factor
        Dim verifyResponse = VerifyFactor(oktaClient, factorID, stateToken)

        'let's pause for 5 seconds for the push notification to be sent
        'Threading.Thread.Sleep(5000)

        ''Check Transaction State
        Dim TransactionStateOptions = New TransactionStateOptions() With {
            .StateToken = stateToken
        }

        Dim transactionState = oktaClient.GetTransactionStateAsync(TransactionStateOptions).Result
        Console.WriteLine($"transactionState: {transactionState}")
    '-----------------------------------------------------------------------------------------
        '-----------------------------------------------------------------------------------------
        ' I never see the AuthenticationStatus change in the do Loop ... after I have responded on my phone
    '-----------------------------------------------------------------------------------------
        '-----------------------------------------------------------------------------------------

        'Check for the success of Okta Verify Push using a loop
        Do


            transactionState = oktaClient.GetTransactionStateAsync(TransactionStateOptions).Result
            Console.WriteLine($"nLoop:transactionState: {transactionState.AuthenticationStatus}")

            If transactionState.AuthenticationStatus = "SUCCESS" Then
                Console.WriteLine("Authentication successful!")
                ' Authentication "SUCCESS"
                oOKTAAuthentication = New OKTAAuthentication(authnResponse.AuthenticationStatus.ToString, authnResponse.SessionToken.ToString)
                Exit Do
            ElseIf transactionState.AuthenticationStatus = "MFA_REQUIRED" Then
                ' MFA challenge is still pending, continue checking
                Threading.Thread.Sleep(5000) ' Wait for 5 seconds before checking again
            ElseIf transactionState.AuthenticationStatus = "MFA_CHALLENGE" Then
                Threading.Thread.Sleep(5000) ' Wait for 5 seconds before checking again
            Else
                Console.WriteLine($"Authentication failed. Status: {transactionState.AuthenticationStatus}")
                ' Authentication failed
                oOKTAAuthentication = New OKTAAuthentication(authnResponse.AuthenticationStatus.ToString, "*****")
                Exit Do
            End If
        Loop While True
    ElseIf authnResponse.AuthenticationStatus = "SUCCESS" Then

Hello,

If you are using push you would push the challenge,

Then use the poll link from above to keep checking,

Not sure when you create a new transaction, rather just use the returned poll link form step 1.

Thank You,

When you say use the Poll Link … What you are referring to, is that:
’ Verify Okta Verify Push Factor
Dim verifyResponse = VerifyFactor(oktaClient, factorID, stateToken)

Should I be watching the verifyFactor in the loop for a change in status?

@erik
When you say use the Poll Link … What you are referring to, is that:
’ Verify Okta Verify Push Factor
Dim verifyResponse = VerifyFactor(oktaClient, factorID, stateToken)

Should I be watching the verifyFactor in the loop for a change in status?

Would you have any example code that I could try?