04-04-2016 23:34
04-04-2016 23:34
Hello,
I'm trying to access my personal application via R using httr and I am getting a redirect_uri error. Currently employing this nifty script I found on Github to try and access the application data:
fitbit_endpoint <- oauth_endpoint( request = "https://api.fitbit.com/oauth2/token", authorize = "https://www.fitbit.com/oauth2/authorize", access = "https://api.fitbit.com/oauth2/token")myapp <- oauth_app( appname = "data_access", key = "Your OAuth 2.0 Client ID", secret = "Your Client (Consumer) Secret") # 2. Get OAuth tokenscope <- c("sleep","activity") # See dev.fitbit.com/docs/oauth2/#scopefitbit_token <- oauth2.0_token(fitbit_endpoint, myapp, scope = scope, use_basic_auth = TRUE) # 3. Make API requestsresp <- GET(url = "https://api.fitbit.com/1/user/-/sleep/date/2016-01-01.json", config(token = fitbit_token))content(resp)
So, anyway, my app is set up as "personal" and "browser" with a callback URI as http://localhost:1410/
Any idea what's amiss?
Thanks
Answered! Go to the Best Answer.
04-05-2016 10:14
04-05-2016 10:14
<face palm>
authorization_uri needs to be set to localhost:14010 and the variable in R script also needs to reflect that.
😞
Now I just have to get the Rcurl fetch to work.
04-04-2016 23:56
04-04-2016 23:56
You need to specify your redirect_uri in your app settings at https://dev.fitbit.com/apps . You should also specify it as a URL parameter on the OAuth 2.0 authorization page.
If you app is just for you, "Personal" is the correct OAuth 2.0 app type. You can ignore the OAuth 1.0a app type.
04-05-2016 10:09
04-05-2016 10:09
What do you mean authorization page? I'm not really developing an app that people will use or navigate. I just want to scrape all of the raw data out of my account so I can develop a data product for myself.
So far I have established an account, set it to browser, personal, read-only and set callback URI to http://localhost:1410/.
In my R script I've set set all of the parameters as noted in the script above, replacing my key/token as necessary.
This is what I get when R tries to authenticate: a browser window opens up to the fitbit auth page and throws this 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 - Missing response_type parameter value
04-05-2016 10:14
04-05-2016 10:14
<face palm>
authorization_uri needs to be set to localhost:14010 and the variable in R script also needs to reflect that.
😞
Now I just have to get the Rcurl fetch to work.
04-05-2016 13:16
04-05-2016 13:16
@wfio wrote:
This is what I get when R tries to authenticate: a browser window opens up to the fitbit auth page and throws this 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 - Missing response_type parameter value
Given the error message, you need to specify a "response_type" value for the authorization page (the page that asks for permission). See https://dev.fitbit.com/docs/oauth2/#authorization-page
04-16-2016 12:32
04-16-2016 12:32
I'm struggling with the same issue you were - when you say "the variable in R script", which variable do you mean? Could you paste your working code? Thanks!
11-24-2016 01:32 - edited 11-24-2016 01:32
11-24-2016 01:32 - edited 11-24-2016 01:32
Well that doesn't really help. I set http://localhost:1410/ as Callback URL as suggested but the error "no valid redirect_uri" remains. Also, I see no way to set this parameter in the httr package.
12-13-2016 02:21
12-13-2016 02:21
Could someone please explain this solution! I have the same problem, i.e. an error message saying "Developer information: invalid_request - Invalid redirect_uri parameter value".
12-13-2016 02:24
12-13-2016 02:24
More specifically, what is "authorization_uri" supposed to mean? And which 'variable is supposed to reflect that'? I wonder how such an ambiguous answer could be flagged "a solution"!?
12-14-2016 13:22
12-14-2016 13:22
@CBSA Most likely meant "redirect_uri", see Jeremiah's post above. Callback url and redirect_uri parameter need to be an exact match.