Archived Forum Post

Index of archived forum posts

Question:

Authentication HTML Fails

Apr 24 '15 at 10:54
CLEAR
Local loHttp
Local lnSuccess
Local lcHtml
LOCAL loUsername
LOCAL loPassword
loUsername = "myusername"
loPassword = "mypassword"
loHttp = Createobject('Chilkat_9_5_0.Http')

lnSuccess = loHttp.UnlockComponent("Anything for 30-day trial")
If (lnSuccess <> 1) Then
    ? loHttp.LastErrorText
    Release loHttp
    Quit
Endif

*  Set the Login and Password properties for authentication.
lohttp.NegotiateAuth = 1
loHttp.Login = loUsername
loHttp.Password = loPassword

lcHtml = loHttp.QuickGetStr("https://www.theurl.com/GatewayWebapp/data/id/9999/app/transactions?lastTransactionNum=0")
? "LastET:"+loHttp.LastErrorText
If (Isnull(lcHtml)) Then
    ? loHttp.LastErrorText
    Release loHttp
    Quit
Endif

This returns the following information:
**HTTP status code for Basic authentication:        401**
-----
ChilkatLog:
  QuickGetStr:
    DllDate: Dec  8 2014
    ChilkatVersion: 9.5.0.46
    UnlockPrefix: Anything for 30-day trial
    Username: USER-LAPTOP:MyUser
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    httpRequestStr:
      a_quickReq:
        quickHttpRequest:
          httpVerb: GET
          url: https://www.theurl.com/GatewayWebapp/data/id/9999/app/transactions?lastTransactionNum=0
          openHttpConnection:
            Opening connection directly to HTTP server.
            httpHostname: www.theurl.com
            httpPort: 443
            ssl: 1
            socket2Connect:
              connect2:
                connectImplicitSsl:
                  clientHandshake:
                    clientHandshake2:
                      readHandshakeMessages:
                        processHandshakeRecord:
                          processHandshakeMessage:
                            processServerHello:
                              serverHelloExtensionsLen: 9
                              HelloExtension: server_name
                              HelloExtensionLen: 0
                              HelloExtension: renegotiation_info
                              HelloExtensionLen: 1
                            --processServerHello
                          --processHandshakeMessage
                        --processHandshakeRecord
                      --readHandshakeMessages
                    --clientHandshake2
                  --clientHandshake
                  checkServerCert:
                    Not verifying server certificate...
                    Set the RequireSslCertVerify property to enable verification.
                  --checkServerCert
                  Secure Channel Established.
                --connectImplicitSsl
              --connect2
            --socket2Connect
            connectElapsedMs: 172
            HTTP connection succeeded.
          --openHttpConnection
          buildQuickRequest:
            genStartLine:
              startLine: GET /GatewayWebapp/data/id/9999/app/transactions?lastTransactionNum=0 HTTP/1.1
            --genStartLine
            addCookies:
              Not auto-adding cookies.
            --addCookies
          --buildQuickRequest
          sendRequestHeader:
            sendHeaderElapsedMs: 0
          --sendRequestHeader
          statusCode: 401
          statusText: Unauthorized
          readResponseBody:
            contentLength: 400
          --readResponseBody
        --quickHttpRequest
        computeAuthorization:
          No useful WWW-Authenticate response header was found.
        --computeAuthorization
        computeAuthorization failed (3).
      --a_quickReq
      convertResponseBodyToUtf8:
        responseHdrCharset: utf-8
      --convertResponseBodyToUtf8
      Returning failed status because of HTTP response code.
    --httpRequestStr
    Failed.
  --QuickGetStr
--ChilkatLog

Due to an NDA I have had to remove the actual URL and change some wording, but the code is otherwise the same. I welcome thoughts on why this fails if possible.