I am attempting to access the fitbit API using ROAuth but keep falling at the first hurdle.

Here is my code:

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()

Running this gives the following rather cryptic error:

Error in strsplit(response, "&") : non-character argument

Any suggestions, greatly appreciated!

有帮助吗?

解决方案

Following the suggestion of @hadley rather than solving the ROAuth problem, I have switched to using the httr package instead. The code in this question worked for me.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top