Results 1 to 8 of 8

Thread: psUserName and psPassword not used by HttpGetJson from cJsonHttpTransfer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default psUserName and psPassword not used by HttpGetJson from cJsonHttpTransfer

    Hi,

    Was just trying to use basic authentication, so figured to set psUserName and psPassword.
    However it never appears to set anything when I look at the request in Fiddler.
    So unless I'm overlooking the obvious, it isn't supported.

    Code:
      Procedure InitializeApiCall
        Set piRemotePort    to rpHttpSSL
        Set peTransferFlags to ifSecure
    
        Set psUsername      to "username"
        Set psPassword      to "password"
      End_Procedure
      
      
      Function Test Returns Boolean
        Boolean bOK
        Handle  hoJson
        String  sHost
        
        Move False To bOK
        Send InitializeApiCall
        Get psMyHost to sHost
        Get HttpGetJson sHost "/api/v2/test" (&bOk) to hoJson
        If (bOK) Begin
    As cJsonHttpTransfer is a grand child class from the InetTransfer class that was slightly unexpected.

    So will have to roll my own (not a problem, but I would at least have expected to see this documented as "unsupported")

    edit: just for anyone else bumping into this, the workaround is
    Code:
        Set pbClearHeaders to False
        Send ClearHeaders
        Get Base64EncodeString ("username"+ ":" + "password") to sBase64
        Get AddHeader "Authorization" ("Basic " + sBase64) to iRetVal
    --
    Wil
    Last edited by wila; 22-Jul-2019 at 01:06 PM. Reason: added workaround

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •