0

我试图在 VBA for Excel 中建立与 TestRail API 的连接,但我不断收到此错误

"{"error":"Authentication failed: invalid or missing user\/password or session cookie."}"

这是 HTTP 请求

userPass = user + ":" + pass

Dim TAuth As New MSXML2.XMLHTTP60

userPass = Base64Encode(userPass)
userPass = "Basic " + userPass

With TAuth
    .Open "POST", "https://testrail.<server>.com/index.php?/api/v2/get_case/3 HTTP/1.1", False
    .SetRequestHeader "Content-Type", "application/json"
    .SetRequestHeader "Accept", "application/json"
    .SetRequestHeader "Authorization", userPass
    .send
    sStatus = .Status
    sErg = .responseText

End With

现在我使用了正确的用户名/密码变量并且服务器地址是准确的并且 Base64Encode() 工作正常。

为什么我收到 Auth failed 错误?

4

0 回答 0