VB.NET Example

This sample assumes the following have been configured:

  • Label1 – UserID prompt
  • Label2 – Password / Passcode prompt
  • TextBoxUserID - UserID Entry
  • TextBoxPasscode - password first, then passcode entry

 

    authenticate.bDebug = True ' setup debug, should be set to false on final role-out
    authenticate.sDebugFile = "test_auth.txt" ' this file is created inc:\debug

 

 

    ' Setup the display
    Label2.Text = "Pin or Password:"
    Label1.Visible = True
    TextBoxUserID.Visible = True

 

 

    ' Call authenticate object
    authenticate.bUseTwoStepAuthentication = True ' all token types use two steps
    authenticate.sUserID = TextBoxUserID.Text ' UserID
    authenticate.sPasscode = TextBoxPasscode.Text ' password step 1 then passcode step 2
    Dim sReturn as String = authenticate.authenticate ' call auth

 

 

 

    ' Check for a second step (required for realtime, Voice Call or UseTwoStep is True)
    If Left(sReturn, 10) = "OK,SESSION" Then
    Step 2, need to prompt for a passcode
    Label2.Text = "Passcode"
    TextBoxPasscode.Text = ""
    Label1.Visible = False
    TextBoxUserID.Visible = False

 

 

 

    ' Set RealTimePostChallenge to True and return the session key
    authenticate.bRealTimePostChallenge = True
    authenticate.sSessionKey = Mid(TextBoxReturn.Text, 12)' cut to key

 

 

 

    ElseIf sReturn = "OK,AUTHOK" Then
    ' Access Accepted
    authenticate.bRealTimePostChallenge = False

 

 

 

    ElseIf sReturn = "OK,DENIED" Then
    ' Access Denied
    authenticate.bRealTimePostChallenge = False

 

 

 

    Else
    ' Error
    authenticate.bRealTimePostChallenge = False

 

 

 

    End If