RCurl: HTTP Authentication When Site Responds With HTTP 401 Code Without WWW-Authenticate

早过忘川 提交于 2019-11-29 05:45:13

I've resolved the problem with the help of the author of RCurl, Duncan Lang. The solution is to explicitly set the httpauth option which sets the authentication method to try initially. This works:

getURL("https://api.picloud.com/job/?jids=12", userpwd="key:secret", httpauth = 1L) 

httpauth is a bitmask specifying which authentication methods to use. See the HTTP Authentication section of the libcurl tutorial for more details.

The equivalent code in httr is:

library(httr)
GET("https://api.picloud.com/job/?jids=12", authenticate("key", "secret"))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!