Sample code for 30+ languages & platforms
DataFlex

Duo Auth API - Check

See more Duo Auth MFA Examples

The /check endpoint can be called to verify that the Auth API integration and secret keys are valid, and that the signature is being generated properly.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    String sIntegrationKey
    String sSecretKey
    Handle hoHttp
    String sUrl
    String sJsonStr
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Move "DIMS3V5QDVG9J9ABRXC4" To sIntegrationKey
    Move "HWVQ46nubLBxhnRlKddTltWIi3hL0fIQF2qTvLab" To sSecretKey

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Set ComAccept Of hoHttp To "application/json"

    // Use your own hostname here:
    Move "https://api-a03782e1.duosecurity.com/auth/v2/check" To sUrl

    Set ComLogin Of hoHttp To sIntegrationKey
    Set ComPassword Of hoHttp To sSecretKey

    Get ComQuickGetStr Of hoHttp sUrl To sJsonStr
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLastStatus Of hoHttp To iTemp1
    Showln "status code = " iTemp1
    Showln sJsonStr

    // Sample successful output:

    // status code = 200
    // {"response": {"time": 1632358829}, "stat": "OK"}


End_Procedure