9
我正在嘗試使用instructions here從命令行創建OAuth令牌。我能夠使用curl
命令行,並得到正確的響應使用RCurl/httr進行Github基本授權
curl -u 'username:pwd' -d '{"scopes":["user", "gist"]}' \
https://api.github.com/authorizations
現在,我想用RCurl
或httr
複製中的R相同。這是我試過的,但是這兩個命令都返回一個錯誤。任何人都可以指出我在這裏做錯了嗎?
httr::POST(
'https://api.github.com/authorizations',
authenticate('username', 'pwd'),
body = list(scopes = list("user", "gist"))
)
RCurl::postForm(
uri = 'https://api.github.com/authorizations',
.opts = list(
postFields = '{"scopes": ["user", "gist"]}',
userpwd = 'username:pwd'
)
)
,嘗試添加'httpauth = 1L' – 2013-04-20 15:12:56
嘗試使用冗餘標誌,看看到底發生了什麼事 – hadley 2013-04-20 15:48:17
而在'authenticate',設置'TYPE = 「基本」' – hadley 2013-04-20 15:50:09