我无法让 Guzzle 使用 Digest Auth 处理请求。我们连接的私有 API 的详细信息是正确的,并且可以使用我们的旧 cURL 代码以及 API 测试应用程序工作,但我无法使用 Guzzle 让它工作。
$client = new Guzzle\Http\Client("http://api.example.com");
$client->post("posts", null, ["title" => "Post title"])
->setAuth("username", "password", "Digest")
->send();
我也尝试将密码包装在md5()
.
...
->setAuth("username", md5("password"), "Digest")
...
以及尝试通过标头进行身份验证。
...
$client->post("posts", [
"request.options" => [
"auth" => ["username", "password", "Digest"]
]
], ["title" => "Post title"])
...
我错过了什么愚蠢的东西吗?我查看了各种文档和示例,但似乎无法使此授权生效。