使用curl测试基本的http身份验证和摘要认证

6

如何使用curl测试摘要认证,如此处所述?

我能够通过将Authorization标头设置为Basic {SECRET}来测试简单基本示例,其中SECRETBase64 :: encode64(“username:password”),如此处所述。

我尝试发送具有相同值的Authentication标头,但在调用authenticate_or_request_with_http_digest的行上获得NoMethodError(undefined method 'unpack' for nil:NilClass)

请问有人可以解释我在这里做错了什么吗?

1个回答

18

最终我成功解决了这个问题。以下是我使用curl测试http基本认证和摘要认证的方法:

curl --data {"red":"00"} --digest -u "username:password" "http://localhost:3000/api/statistics"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接