【发布时间】:2013-06-02 10:45:43
【问题描述】:
我正在尝试使用 ROAuth 访问 fitbit API,但一直遇到第一个障碍。
这是我的代码:
library(ROAuth)
reqURL <- "https://api.fitbit.com/oauth/request_token"
accessURL <- "https://api.fitbit.com/oauth/access_token"
authURL <- "https://www.fitbit.com/oauth/authorize"
cKey <- "xxxxx"
cSecret <- "xxxxx"
credentials <- OAuthFactory$new(consumerKey=cKey,
consumerSecret=cSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
credentials$handshake()
运行它会产生以下相当神秘的错误:
Error in strsplit(response, "&") : non-character argument
任何建议,不胜感激!
【问题讨论】:
-
我会做类似
options(error = recover)的事情,并尝试在其被调用的环境中评估response表达式。 -
响应 [1] 6f 61 ... [100] 75 74 ... 64 3d 74 72 75 65 attr(,"Content-Type") 字符集 "application/x-www-form- urlencoded" "UTF-8"
-
这是
response的编辑摘录。不知道该怎么做! -
您可能会发现在 httr 中使用 OAuth 支持更容易。
-
非常感谢@hadley,我会试试的。