问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/16882011/strsplit-error-when-attempting-to-access-fitbit-with-roauth