Sample code for 30+ languages & platforms
VBScript Requires Chilkat v11.6.0+

Amazon Cognito: Enroll an Authenticator for TOTP MFA

See more Amazon Cognito Examples

Enable software-token MFA in the pool first. Choose mode=signed_in to enroll with a user access token containing aws.cognito.signin.user.admin, or mode=challenge to continue the MFA_SETUP saved by the sign-in example. Begin obtains a secret and saves it in private cognito-totp.json. Present secret_code securely to the user for manual entry or an otpauth QR code; never place it in ordinary logs. Then set action=verify with the authenticator's code in private totp-input.json.

Checks VerifySoftwareToken.Status=SUCCESS before activating the preference or finishing sign-in. A signed-in enrollment sets SoftwareTokenMfaSettings.Enabled and PreferredMfa. Challenge enrollment uses the successive Session values from AssociateSoftwareToken and VerifySoftwareToken, then RespondToAuthChallenge(MFA_SETUP). Verifying a replacement authenticator can disassociate the old one. If a later step fails after successful verification, inspect the user's MFA/sign-in state rather than repeatedly beginning enrollment.

Uses direct Chilkat.Http requests to the regional Cognito User Pools JSON API. Public app-client operations do not use IAM signing. These examples use a public app client without a client secret; do not add administrative AWS credentials. For a confidential app client, implement the operation-specific SecretHash/SECRET_HASH or ClientSecret requirements on a trusted system.

Create qa_data/cognito/app.json with string fields region (for example us-west-2), user_pool_id, client_id, and account_key (your local account identifier). OAuth examples also require domain, the trusted HTTPS base URL of your Cognito domain, without a trailing slash. The region and user pool must match the app client. These examples use commercial AWS endpoints.

Sample cache/input files contain secrets. Use an access-controlled directory outside web content and source control, separate each local user/account, and serialize operations that modify the same cache. In a real application obtain passwords and codes through private UI instead of leaving them in files. Cache writes retain a .bak copy; protect and remove obsolete backups and challenge files after the flow. Production storage should provide atomic replacement and OS-backed secret protection. Never restore an old refresh token automatically after rotation. These examples do not require a hosted web server.

Checks transport completion, HTTP status, and required response fields before using results. Cognito often reports throttling, invalid codes, and authentication failures as HTTP 400. Present generic sign-in/recovery errors to users; keep detailed diagnostics private. Retry throttled reads with bounded backoff, but reconcile uncertain writes and refresh rotations before repeating them.

AWS documentation 1 | AWS documentation 2 | AWS documentation 3

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

'  Assumes Chilkat is unlocked. See Global Unlock Sample.
success = 0
'  App settings are trusted configuration. Keep a separate account_key/cache per local user.
set app = CreateObject("Chilkat.JsonObject")
app.Strict = 1
success = app.LoadFile("qa_data/cognito/app.json")
If (success <> 1) Then
    outFile.WriteLine("Could not load Cognito app settings.")
    WScript.Quit
End If

If ((app.JsonTypeOf("region") <> 1) Or (app.StringOf("region") = "")) Then
    outFile.WriteLine("Missing or invalid region.")
    WScript.Quit
End If

If ((app.JsonTypeOf("user_pool_id") <> 1) Or (app.StringOf("user_pool_id") = "")) Then
    outFile.WriteLine("Missing or invalid user_pool_id.")
    WScript.Quit
End If

If ((app.JsonTypeOf("client_id") <> 1) Or (app.StringOf("client_id") = "")) Then
    outFile.WriteLine("Missing or invalid client_id.")
    WScript.Quit
End If

If ((app.JsonTypeOf("account_key") <> 1) Or (app.StringOf("account_key") = "")) Then
    outFile.WriteLine("Missing or invalid account_key.")
    WScript.Quit
End If

clientId = app.StringOf("client_id")
set endpoint = CreateObject("Chilkat.StringBuilder")
success = endpoint.Append("https://cognito-idp.")
success = endpoint.Append(app.StringOf("region"))
success = endpoint.Append(".amazonaws.com/")
set http = CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1
http.FollowRedirects = 0
http.ConnectTimeout = 20
http.ReadTimeout = 60
set resp = CreateObject("Chilkat.HttpResponse")
set body = CreateObject("Chilkat.JsonObject")
set result = CreateObject("Chilkat.JsonObject")
result.Strict = 1
action = "begin"
mode = "signed_in"
If ((action <> "begin") And (action <> "verify")) Then
    outFile.WriteLine("Choose begin or verify.")
    WScript.Quit
End If

If ((mode <> "signed_in") And (mode <> "challenge")) Then
    outFile.WriteLine("Choose signed_in or challenge.")
    WScript.Quit
End If

username = ""
set credential = CreateObject("Chilkat.JsonObject")
If (mode = "signed_in") Then
    success = credential.LoadFile("qa_data/tokens/cognito-user.json")
    If (success <> 1) Then
        outFile.WriteLine("Could not load user tokens.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("client_id") <> 1) Or (credential.StringOf("client_id") = "")) Then
        outFile.WriteLine("Missing or invalid client_id.")
        WScript.Quit
    End If

    If (credential.StringOf("client_id") <> app.StringOf("client_id")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("user_pool_id") <> 1) Or (credential.StringOf("user_pool_id") = "")) Then
        outFile.WriteLine("Missing or invalid user_pool_id.")
        WScript.Quit
    End If

    If (credential.StringOf("user_pool_id") <> app.StringOf("user_pool_id")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("account_key") <> 1) Or (credential.StringOf("account_key") = "")) Then
        outFile.WriteLine("Missing or invalid account_key.")
        WScript.Quit
    End If

    If (credential.StringOf("account_key") <> app.StringOf("account_key")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("access_token") <> 1) Or (credential.StringOf("access_token") = "")) Then
        outFile.WriteLine("Missing or invalid access_token.")
        WScript.Quit
    End If

Else
    success = credential.LoadFile("qa_data/tokens/cognito-challenge.json")
    If (success <> 1) Then
        outFile.WriteLine("Could not load the MFA_SETUP challenge.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("client_id") <> 1) Or (credential.StringOf("client_id") = "")) Then
        outFile.WriteLine("Missing or invalid client_id.")
        WScript.Quit
    End If

    If (credential.StringOf("client_id") <> app.StringOf("client_id")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("user_pool_id") <> 1) Or (credential.StringOf("user_pool_id") = "")) Then
        outFile.WriteLine("Missing or invalid user_pool_id.")
        WScript.Quit
    End If

    If (credential.StringOf("user_pool_id") <> app.StringOf("user_pool_id")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("account_key") <> 1) Or (credential.StringOf("account_key") = "")) Then
        outFile.WriteLine("Missing or invalid account_key.")
        WScript.Quit
    End If

    If (credential.StringOf("account_key") <> app.StringOf("account_key")) Then
        outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("Session") <> 1) Or (credential.StringOf("Session") = "")) Then
        outFile.WriteLine("Missing or invalid Session.")
        WScript.Quit
    End If

    If ((credential.JsonTypeOf("username") <> 1) Or (credential.StringOf("username") = "")) Then
        outFile.WriteLine("Missing or invalid username.")
        WScript.Quit
    End If

    If (credential.StringOf("ChallengeName") <> "MFA_SETUP") Then
        outFile.WriteLine("Expected an MFA_SETUP challenge.")
        WScript.Quit
    End If

    username = credential.StringOf("username")
End If

If (action = "begin") Then
    If (mode = "signed_in") Then
        success = body.UpdateString("AccessToken",credential.StringOf("access_token"))
    Else
        success = body.UpdateString("Session",credential.StringOf("Session"))
    End If

    http.SetRequestHeader "X-Amz-Target","AWSCognitoIdentityProviderService.AssociateSoftwareToken"
    success = http.HttpJson("POST",endpoint.GetAsString(),body,"application/x-amz-json-1.0",resp)
    If (resp.StatusCode <> 200) Then
        outFile.WriteLine("HTTP status: " & resp.StatusCode)
        success = result.Load(resp.BodyStr)
        If (success = 1) Then
            outFile.WriteLine("Error type: " & result.StringOf("__type"))
            outFile.WriteLine("OAuth error: " & result.StringOf("error"))
        End If

        '  Inspect detailed diagnostics privately. Do not log passwords, sessions, or tokens.
        WScript.Quit
    End If

    If (success <> 1) Then
        outFile.WriteLine("The HTTP exchange did not complete.")
        WScript.Quit
    End If

    success = result.Load(resp.BodyStr)
    If (success <> 1) Then
        outFile.WriteLine("Expected a JSON response.")
        WScript.Quit
    End If

    If ((result.JsonTypeOf("SecretCode") <> 1) Or (result.StringOf("SecretCode") = "")) Then
        outFile.WriteLine("Missing or invalid SecretCode.")
        WScript.Quit
    End If

    set newEnrollment = CreateObject("Chilkat.JsonObject")
    success = newEnrollment.UpdateString("secret_code",result.StringOf("SecretCode"))
    success = newEnrollment.UpdateString("mode",mode)
    success = newEnrollment.UpdateString("username",username)
    If (mode = "challenge") Then
        If ((result.JsonTypeOf("Session") <> 1) Or (result.StringOf("Session") = "")) Then
            outFile.WriteLine("Missing or invalid Session.")
            WScript.Quit
        End If

        success = newEnrollment.UpdateString("session",result.StringOf("Session"))
        '  Bind enrollment to this precise challenge, not just the account.
        success = newEnrollment.UpdateString("original_session",credential.StringOf("Session"))
    End If

    success = newEnrollment.UpdateString("client_id",app.StringOf("client_id"))
    success = newEnrollment.UpdateString("user_pool_id",app.StringOf("user_pool_id"))
    success = newEnrollment.UpdateString("account_key",app.StringOf("account_key"))
    set newEnrollmentTOTPenrollment = CreateObject("Chilkat.FileAccess")
    success = newEnrollmentTOTPenrollment.DirEnsureExists("qa_data/tokens")
    If (success <> 1) Then
        outFile.WriteLine("Could not create the private cache directory.")
        WScript.Quit
    End If

    If (newEnrollmentTOTPenrollment.FileExists("qa_data/tokens/cognito-totp.json") = 1) Then
        success = newEnrollmentTOTPenrollment.FileCopy("qa_data/tokens/cognito-totp.json","qa_data/tokens/cognito-totp.json.bak",0)
        If (success <> 1) Then
            outFile.WriteLine("Could not back up the existing cache.")
            WScript.Quit
        End If

    End If

    success = newEnrollment.WriteFile("qa_data/tokens/cognito-totp.json")
    If (success <> 1) Then
        outFile.WriteLine("Could not save TOTP enrollment; preserve any previous backup.")
        WScript.Quit
    End If

    outFile.WriteLine("Enrollment saved. Present secret_code privately in your authenticator setup UI.")
    '  This secret can generate future OTPs. Never log it or email it.
    WScript.Quit
End If

set enrollment = CreateObject("Chilkat.JsonObject")
enrollment.Strict = 1
success = enrollment.LoadFile("qa_data/tokens/cognito-totp.json")
If (success <> 1) Then
    outFile.WriteLine("Could not load qa_data/tokens/cognito-totp.json.")
    WScript.Quit
End If

If ((enrollment.JsonTypeOf("client_id") <> 1) Or (enrollment.StringOf("client_id") = "")) Then
    outFile.WriteLine("Missing or invalid client_id.")
    WScript.Quit
End If

If (enrollment.StringOf("client_id") <> app.StringOf("client_id")) Then
    outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
    WScript.Quit
End If

If ((enrollment.JsonTypeOf("user_pool_id") <> 1) Or (enrollment.StringOf("user_pool_id") = "")) Then
    outFile.WriteLine("Missing or invalid user_pool_id.")
    WScript.Quit
End If

If (enrollment.StringOf("user_pool_id") <> app.StringOf("user_pool_id")) Then
    outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
    WScript.Quit
End If

If ((enrollment.JsonTypeOf("account_key") <> 1) Or (enrollment.StringOf("account_key") = "")) Then
    outFile.WriteLine("Missing or invalid account_key.")
    WScript.Quit
End If

If (enrollment.StringOf("account_key") <> app.StringOf("account_key")) Then
    outFile.WriteLine("Saved data belongs to another client, pool, or local account.")
    WScript.Quit
End If

If (enrollment.StringOf("mode") <> mode) Then
    outFile.WriteLine("Enrollment mode mismatch.")
    WScript.Quit
End If

set input = CreateObject("Chilkat.JsonObject")
input.Strict = 1
success = input.LoadFile("qa_data/cognito/totp-input.json")
If (success <> 1) Then
    outFile.WriteLine("Could not load qa_data/cognito/totp-input.json.")
    WScript.Quit
End If

If ((input.JsonTypeOf("code") <> 1) Or (input.StringOf("code") = "")) Then
    outFile.WriteLine("Missing or invalid code.")
    WScript.Quit
End If

'  Enter a fresh six-digit code from the authenticator; preserve leading zeroes.
success = body.UpdateString("UserCode",input.StringOf("code"))
success = body.UpdateString("FriendlyDeviceName","Authenticator")
If (mode = "signed_in") Then
    success = body.UpdateString("AccessToken",credential.StringOf("access_token"))
Else
    If ((enrollment.JsonTypeOf("session") <> 1) Or (enrollment.StringOf("session") = "")) Then
        outFile.WriteLine("Missing or invalid session.")
        WScript.Quit
    End If

    If (enrollment.StringOf("original_session") <> credential.StringOf("Session")) Then
        outFile.WriteLine("Enrollment belongs to another sign-in challenge.")
        WScript.Quit
    End If

    success = body.UpdateString("Session",enrollment.StringOf("session"))
End If

http.SetRequestHeader "X-Amz-Target","AWSCognitoIdentityProviderService.VerifySoftwareToken"
success = http.HttpJson("POST",endpoint.GetAsString(),body,"application/x-amz-json-1.0",resp)
If (resp.StatusCode <> 200) Then
    outFile.WriteLine("HTTP status: " & resp.StatusCode)
    success = result.Load(resp.BodyStr)
    If (success = 1) Then
        outFile.WriteLine("Error type: " & result.StringOf("__type"))
        outFile.WriteLine("OAuth error: " & result.StringOf("error"))
    End If

    '  Inspect detailed diagnostics privately. Do not log passwords, sessions, or tokens.
    WScript.Quit
End If

If (success <> 1) Then
    outFile.WriteLine("The HTTP exchange did not complete.")
    WScript.Quit
End If

success = result.Load(resp.BodyStr)
If (success <> 1) Then
    outFile.WriteLine("Expected a JSON response.")
    WScript.Quit
End If

If (result.StringOf("Status") <> "SUCCESS") Then
    outFile.WriteLine("Authenticator verification did not succeed; do not enable it.")
    WScript.Quit
End If

'  Verification succeeded. Discard the enrollment secret and its backup.
set removeEnrollment = CreateObject("Chilkat.FileAccess")
success = removeEnrollment.FileDelete("qa_data/tokens/cognito-totp.json")
If (removeEnrollment.FileExists("qa_data/tokens/cognito-totp.json.bak") = 1) Then
    success = removeEnrollment.FileDelete("qa_data/tokens/cognito-totp.json.bak")
End If

success = body.Load("{}")
If (success <> 1) Then
    outFile.WriteLine("Could not reset the request body.")
    WScript.Quit
End If

If (mode = "signed_in") Then
    success = body.UpdateString("AccessToken",credential.StringOf("access_token"))
    success = body.UpdateBool("SoftwareTokenMfaSettings.Enabled",1)
    success = body.UpdateBool("SoftwareTokenMfaSettings.PreferredMfa",1)
    http.SetRequestHeader "X-Amz-Target","AWSCognitoIdentityProviderService.SetUserMFAPreference"
    success = http.HttpJson("POST",endpoint.GetAsString(),body,"application/x-amz-json-1.0",resp)
    If (resp.StatusCode <> 200) Then
        outFile.WriteLine("HTTP status: " & resp.StatusCode)
        success = result.Load(resp.BodyStr)
        If (success = 1) Then
            outFile.WriteLine("Error type: " & result.StringOf("__type"))
            outFile.WriteLine("OAuth error: " & result.StringOf("error"))
        End If

        '  Inspect detailed diagnostics privately. Do not log passwords, sessions, or tokens.
        WScript.Quit
    End If

    If (success <> 1) Then
        outFile.WriteLine("The HTTP exchange did not complete.")
        WScript.Quit
    End If

    outFile.WriteLine("Authenticator verified and set as the preferred MFA method.")
    WScript.Quit
End If

If ((result.JsonTypeOf("Session") <> 1) Or (result.StringOf("Session") = "")) Then
    outFile.WriteLine("Missing or invalid Session.")
    WScript.Quit
End If

'  Submit the NEW Session returned by VerifySoftwareToken, not the earlier one.
success = body.UpdateString("ClientId",clientId)
success = body.UpdateString("ChallengeName","MFA_SETUP")
success = body.UpdateString("Session",result.StringOf("Session"))
success = body.UpdateString("ChallengeResponses.USERNAME",username)
http.SetRequestHeader "X-Amz-Target","AWSCognitoIdentityProviderService.RespondToAuthChallenge"
success = http.HttpJson("POST",endpoint.GetAsString(),body,"application/x-amz-json-1.0",resp)
If (resp.StatusCode <> 200) Then
    outFile.WriteLine("HTTP status: " & resp.StatusCode)
    success = result.Load(resp.BodyStr)
    If (success = 1) Then
        outFile.WriteLine("Error type: " & result.StringOf("__type"))
        outFile.WriteLine("OAuth error: " & result.StringOf("error"))
    End If

    '  Inspect detailed diagnostics privately. Do not log passwords, sessions, or tokens.
    WScript.Quit
End If

If (success <> 1) Then
    outFile.WriteLine("The HTTP exchange did not complete.")
    WScript.Quit
End If

success = result.Load(resp.BodyStr)
If (success <> 1) Then
    outFile.WriteLine("Expected a JSON response.")
    WScript.Quit
End If

If (result.JsonTypeOf("AuthenticationResult") = 3) Then
    set token = CreateObject("Chilkat.JsonObject")
    success = token.UpdateString("access_token",result.StringOf("AuthenticationResult.AccessToken"))
    success = token.UpdateString("id_token",result.StringOf("AuthenticationResult.IdToken"))
    success = token.UpdateString("token_type",result.StringOf("AuthenticationResult.TokenType"))
    success = token.UpdateInt("expires_in",result.IntOf("AuthenticationResult.ExpiresIn"))
    If (result.HasMember("AuthenticationResult.RefreshToken") = 1) Then
        success = token.UpdateString("refresh_token",result.StringOf("AuthenticationResult.RefreshToken"))
    End If

    If ((token.JsonTypeOf("access_token") <> 1) Or (token.StringOf("access_token") = "")) Then
        outFile.WriteLine("Missing or invalid access_token.")
        WScript.Quit
    End If

    If ((token.JsonTypeOf("id_token") <> 1) Or (token.StringOf("id_token") = "")) Then
        outFile.WriteLine("Missing or invalid id_token.")
        WScript.Quit
    End If

    If ((token.JsonTypeOf("expires_in") <> 2) Or (token.IntOf("expires_in") <= 0)) Then
        outFile.WriteLine("Expected a positive token lifetime.")
        WScript.Quit
    End If

    If (token.StringOf("token_type") <> "Bearer") Then
        outFile.WriteLine("Expected Bearer tokens.")
        WScript.Quit
    End If

    If ((token.JsonTypeOf("refresh_token") <> 1) Or (token.StringOf("refresh_token") = "")) Then
        outFile.WriteLine("Missing or invalid refresh_token.")
        WScript.Quit
    End If

    success = token.UpdateString("client_id",app.StringOf("client_id"))
    success = token.UpdateString("user_pool_id",app.StringOf("user_pool_id"))
    success = token.UpdateString("account_key",app.StringOf("account_key"))
    set obtained = CreateObject("Chilkat.CkDateTime")
    success = obtained.SetFromCurrentSystemTime()
    If (success <> 1) Then
        outFile.WriteLine("Could not get the acquisition time.")
        WScript.Quit
    End If

    success = token.UpdateString("obtained_at",obtained.GetAsTimestamp(0))
    set tokenusertokens = CreateObject("Chilkat.FileAccess")
    success = tokenusertokens.DirEnsureExists("qa_data/tokens")
    If (success <> 1) Then
        outFile.WriteLine("Could not create the private cache directory.")
        WScript.Quit
    End If

    If (tokenusertokens.FileExists("qa_data/tokens/cognito-user.json") = 1) Then
        success = tokenusertokens.FileCopy("qa_data/tokens/cognito-user.json","qa_data/tokens/cognito-user.json.bak",0)
        If (success <> 1) Then
            outFile.WriteLine("Could not back up the existing cache.")
            WScript.Quit
        End If

    End If

    success = token.WriteFile("qa_data/tokens/cognito-user.json")
    If (success <> 1) Then
        outFile.WriteLine("Could not save user tokens; preserve any previous backup.")
        WScript.Quit
    End If

    '  A completed flow no longer needs its short-lived challenge session.
    set cleanup = CreateObject("Chilkat.FileAccess")
    If (cleanup.FileExists("qa_data/tokens/cognito-challenge.json") = 1) Then
        success = cleanup.FileDelete("qa_data/tokens/cognito-challenge.json")
    End If

    outFile.WriteLine("Sign-in completed; private token cache saved.")
    WScript.Quit
End If

If ((result.JsonTypeOf("ChallengeName") <> 1) Or (result.StringOf("ChallengeName") = "")) Then
    outFile.WriteLine("Missing or invalid ChallengeName.")
    WScript.Quit
End If

If ((result.JsonTypeOf("Session") <> 1) Or (result.StringOf("Session") = "")) Then
    outFile.WriteLine("Missing or invalid Session.")
    WScript.Quit
End If

'  ChallengeParameters may provide the canonical username after alias-based sign-in.
If ((result.JsonTypeOf("ChallengeParameters.USER_ID_FOR_SRP") = 1) And (result.StringOf("ChallengeParameters.USER_ID_FOR_SRP") <> "")) Then
    username = result.StringOf("ChallengeParameters.USER_ID_FOR_SRP")
End If

If ((result.JsonTypeOf("ChallengeParameters.USERNAME") = 1) And (result.StringOf("ChallengeParameters.USERNAME") <> "")) Then
    username = result.StringOf("ChallengeParameters.USERNAME")
End If

success = result.UpdateString("username",username)
success = result.UpdateString("client_id",app.StringOf("client_id"))
success = result.UpdateString("user_pool_id",app.StringOf("user_pool_id"))
success = result.UpdateString("account_key",app.StringOf("account_key"))
set resultauthenticationchallenge = CreateObject("Chilkat.FileAccess")
success = resultauthenticationchallenge.DirEnsureExists("qa_data/tokens")
If (success <> 1) Then
    outFile.WriteLine("Could not create the private cache directory.")
    WScript.Quit
End If

If (resultauthenticationchallenge.FileExists("qa_data/tokens/cognito-challenge.json") = 1) Then
    success = resultauthenticationchallenge.FileCopy("qa_data/tokens/cognito-challenge.json","qa_data/tokens/cognito-challenge.json.bak",0)
    If (success <> 1) Then
        outFile.WriteLine("Could not back up the existing cache.")
        WScript.Quit
    End If

End If

success = result.WriteFile("qa_data/tokens/cognito-challenge.json")
If (success <> 1) Then
    outFile.WriteLine("Could not save authentication challenge; preserve any previous backup.")
    WScript.Quit
End If

outFile.WriteLine("Further authentication required: " & result.StringOf("ChallengeName"))
'  Collect the requested input in your application's UI; never print the Session value.

outFile.Close