Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

invalid_request - Invalid redirect_uri parameter value

Hi,

I'm getting this error in after login to my web application today.

Developer information: invalid_request - Invalid redirect_uri parameter value

It was working well for past weeks, but today I'm getting this error.

Could someone help on this issue?

 

Best Answer
0 Votes
13 REPLIES 13

After registering my app, tried opening this link  https://www.fitbit.com/oauth2/authorize

Thrown 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

 

Can some please suggest to me how to handle this error?

Best Answer
0 Votes

@fransis.cl and @Handsonlab 

 

Would you please provide the complete /oauth/authorize URL you're trying to execute?

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes
the code which should give me n live data of my fitbit other than downloading  .csv from the website. The below are the steps I followed, please let me know where the exact problem is ?
 
I'm writing a code where it should  give me all the heart rate , accelerator values and sleep data. image2.png

 

 
Step-1:
I started from this, first registered an application name and these are the values I used to get the client id and secret id.

 

Step-2:
Soon after submitting the application I got Client id and secret Id
image3.png

 

Step-3: 
I have a python code where I am authorizing those credentials
 
Python code:
import fitbit
import gather_keys_oauth2 as Oauth2
import pandas as pd 
import datetime
CLIENT_ID = '*****'
CLIENT_SECRET = '*******'
server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET)
server.browser_authorize()
ACCESS_TOKEN = str(server.fitbit.client.session.token['access_token'])
REFRESH_TOKEN = str(server.fitbit.client.session.token['refresh_token'])
auth2_client = fitbit.Fitbit(CLIENT_ID, CLIENT_SECRET, oauth2=True, access_token=ACCESS_TOKEN, refresh_token=REFRESH_TOKEN)
 
Step-4
when i run above snippet i am redirecting to below url and asking permissions.
Step-5: 
After pressing allow button it is redirected to below link and throwed an error.
 
image5.png

 

 
Please help me out with any external language which helps me in getting live data and support other than fit JS(fitbit studio) language.
 
Please help me as fast as possible because it been so long I am waitng for getting data from code. 
Best Answer
0 Votes

Hi @Handsonlab 

 

I'm not seeing the original error you reported.   But some things I do notice are

  1. your callback URL should be https, not http
  2. The authorization code is in your URL as it should be

http://127.0.0.1:8080/?code=1c72416200d6155bbb80a4c3ae451325afbff816&state=LD2rxRJGBAz8BFB3phmNYJhSd...

 

3. The error message looks like it's coming from the OAuth2 library. 

 

Check out this forum post.   I believe your error is similar to what this user was getting.  A solution is provided at the bottom

 

https://community.fitbit.com/t5/Web-API-Development/Invalid-Client-Error/m-p/3290401

  

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

Thanks @GordonFitbit, It did work if i run on command line and it is not working with Jupyternotebook.

python gather_keys_oauth2.py <client-id> <secret_id>

I Initialized all the client_id and secret_id in "gather_keys_oauth2.py" init function. Even though it is not functioning from jupyter notebook.

 

 

Anyway, thanks at least it is working in one way. If you know the reason why?  please let me know

Best Answer
0 Votes

Hi Handsonlab,

 

If you're using the oracsgit python library, verify you're using the following versions of the libraries

 

`requests-oauthlib == 1.1.0` and `oauthlib == 2.1.0`

 

These versions resolved the "Invalid Client Error".  I'm assuming there is a bug in the newer version that needs to be fixed by the owner of the OAuth library.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer

 It is working, I have a doubt how can I get a continuous sleep value using python.

Best Answer
0 Votes

Would you describe what you mean by "continuous sleep value"?

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes
I mean I should get value like awake or normal status every second? With
the PYTHON API

Thanks,
Chandu
--



*Thanks & Regards,*
Chandu
Best Answer
0 Votes

The Web APIs don't returns sleep stages every second.  The sleep data is returned with only 30 or 60-second granularity.

 

https://dev.fitbit.com/build/reference/web-api/sleep/#get-sleep-logs

 

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

my requesting url:

URL: https://api.fitbit.com/1.2/user/-/sleep.json?date=2019-3-8&startTime=02:32&duration=720000

-----------

Traceback (most recent call last):
File "gather_keys_oauth2.py", line 87, in <module>
sleep_data = server.fitbit.get_sleep_granularity(datetime.datetime(2019, 3, 8, 0, 0))
File "Z:\python-fitbit-master\fitbit\api.py", line 811, in get_sleep_granularity
return self.make_request(url)
File "Z:\python-fitbit-master\fitbit\api.py", line 255, in make_request
response = self.client.make_request(*args, **kwargs)
File "Z:\python-fitbit-master\fitbit\api.py", line 99, in make_request
exceptions.detect_and_raise_error(response)
File "Z:\python-fitbit-master\fitbit\exceptions.py", line 86, in detect_and_raise_error
raise HTTPNotFound(response)
fitbit.exceptions.HTTPNotFound: The API you are requesting could not be found.

 

 

Can some please reply why this API does not exist?

Best Answer
0 Votes

Hi @Handsonlab 

 

I cannot reproduce an error using the same syntax.  Would you please private message me your client ID, the user ID and roughly the time the API call was made?

 

Thanks!

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

@Handsonlab 

 

Actually, I did find one scenario where I could reproduce the error message.  This API call supports the HTTP Verb POST only.   If I change the Verb to GET, I receive the error "The API you are requesting could not be found."

 

Before sending me the information I requested in the previous post, please verify the Verb you're using.

 

Here's the link to the documentation on that endpoint: https://dev.fitbit.com/build/reference/web-api/sleep/#log-sleep.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer