- « Previous
-
- 1
- 2
- Next »
08-29-2015 16:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-29-2015 16:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hey all - does anyone have a working R script to access the API?
Everything I've got and research I've done to authenticate via oauth 1 or 2 seems broken using the httr package.
For oauth 2:
library(httr) app = '<OAuth 2.0 Client ID>' key <- '<Client (Consumer) Key>' secret <- '<Client (Consumer) Secret>' accessTokenURL <- 'https://api.fitbit.com/oauth2/token' authorizeURL <- 'https://www.fitbit.com/oauth2/authorize' fbr <- oauth_app(key,app,NULL) fitbit <- oauth_endpoint(NULL, authorizeURL,accessTokenURL) token <- oauth2.0_token(fitbit,fbr,scope='profile',as_header=TRUE, cache=FALSE)
When I check token$credentials I get the error message:
$errors $errors[[1]] $errors[[1]]$errorType [1] "oauth" $errors[[1]]$fieldName [1] "n/a" $errors[[1]]$message [1] "No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed" $success [1] FALSE
I have tried all the misc settings in fitbit setting up my app, both as a server and a client, and I have my callback URL correctly set up as http://localhost:1410
I'm running in R Studio version 0.98.1102 and R
Any ideas?
Thanks,
Isaac
Current session info:
R version 3.1.2 (2014-10-31) Platform: x86_64-apple-darwin13.4.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] httr_1.0.0 loaded via a namespace (and not attached): [1] curl_0.9.3 httpuv_1.3.2 jsonlite_0.9.14 R6_2.0.1 Rcpp_0.11.4 stringr_0.6.2 [7] tools_3.1.2
Answered! Go to the Best Answer.
04-11-2016 10:09 - edited 04-11-2016 10:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-11-2016 10:09 - edited 04-11-2016 10:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
So I have http://localhost:1410 in the callback URI
Here are my app settings:

04-11-2016 10:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-11-2016 10:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-11-2016 11:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-11-2016 11:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Change your Callback URL in your Application Setttings from
http://localhost:1410/
to
http://localhost:1410

04-11-2016 12:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-11-2016 12:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
BOOM!
That did it. That brought me to a grant authorization page!
Now I get this error
$errors
$errors[[1]]
$errors[[1]]$errorType
[1] "validation"
$errors[[1]]$fieldName
[1] "resource path"
$errors[[1]]$message
[1] "Invalid time series resource path: /activities/activity"
I think I can figure out how to sort through this by going through the API docs again

06-04-2016 09:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-04-2016 09:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
After a break of a couple of months I ran the same scripts again (that were working before) and got the error:
The app you're trying to connect did not provide valid information to Fitbit. Please report this issue to them.
Developer information: invalid_request - Invalid redirect_uri parameter value
http://localhost:1410
to
http://localhost:1410/
I'm not sure if my update to httr 1.1 (dev version downloaded today) made any difference. Just mentioning in case anyone runs into the same issue.
10-30-2017 14:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-30-2017 14:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I get the following errors
"Error in structure(list(method = method, url = url, headers = keep_last(headers), :
object 'token' not found"
"Error in as.request(config) : object 'gtoken' not found"


- « Previous
-
- 1
- 2
- Next »