Sample code for 30+ languages & platforms
AutoIt

HTTP Basic Authentication Test

Demonstrates how to do HTTP basic authentication using Chilkat.

Chilkat AutoIt Downloads

AutoIt
;  This example requires the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat.Http")

;  To use HTTP Basic authentication:
$oHttp.Login = "myLogin"
$oHttp.Password = "myPassword"
$oHttp.BasicAuth = True

;  Run the test using this URL with the credentials above.  
;  (Works while httpbin.org keeps the test endpoint available.)
Local $sJsonResponse = $oHttp.QuickGetStr("https://httpbin.org/basic-auth/myLogin/myPassword")
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Response status code: " & $oHttp.LastStatus & @CRLF)

ConsoleWrite($sJsonResponse & @CRLF)

;  Output:

;  Response status code: 200
;  {
;    "authenticated": true, 
;    "user": "myLogin"
;  }