Comments (21)
Hi again,
As I successfully obtain my token using another Fitbit API client (https://github.com/magnific0/FitBit.py), it seems there is a problem with your script "gather_keys_oauth2.py".
I would say that oauthlib call using OAuth2Session should not try to validate the token during the request phase.
Best,
Fabien
from python-fitbit.
Same issue, but without resolution for me. I have OAuth version 1 working but I need version 2 in order to do the stuff I need. Any resolution other than the one PertuyF used?
from python-fitbit.
I'm having the same issue as well
from python-fitbit.
@kevingoldsmith @splunkzilla @PertuyF This should be fixed in #72
from python-fitbit.
Confirmed the fix in branch fix-oauth2. It working successfully, without any issues.
from python-fitbit.
Also tried the branch and it works for me too.
from python-fitbit.
Also tried the branch and it works for me too.
from python-fitbit.
Look like it's been merged on master, it worked for me.
from python-fitbit.
Can this fix please be released? The version available through pypi doesn't currently support OAuth2 as far as I can tell.
from python-fitbit.
I don't think this is fully working yet.
I just ran into some trouble using the latest version (master hash 01c2023) which has the fixed as mentioned by @brad #70
Specifically:
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
I revert to the version before the fix (master hash f0166f6)
and things work correctly. I am able to get access tokens without issues (no other changes made)
I quickly glanced at the commit diffs between the two version and this is the only change I could potentially see as being related.
from python-fitbit.
This also my first attempt at OAuth2. I'm not having any luck authenticating either. I put in http:/127.0.0.1:8080 as my Callback URL (is that right?) in the App registration page. When I use the "OAuth 2.0 Client ID" and "Client (Consumer) Secret" values provided as command line parameters in gather_keys_oauth2.py, it seems to launch a webserver and causes my browser to go to a fitbit site but the webpage just says:
"Fitbit
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"
I'm using the latest master branch. Anyone have any suggestions?
Thanks,
from python-fitbit.
@randi120 I'm using 01c2023 without issue.
from python-fitbit.
@Josh2K your callback URL should be http://127.0.0.1:8080/, not http:/127.0.0.1:8080
from python-fitbit.
@JamesGardiner are you getting new tokens or using already saved ones?
When I try to get tokens on 01c2023 I get the following:
Traceback (most recent call last):
File "./my_oauth2_gather_key.py", line 78, in <module>
getter.set_code(callback_answer.code)
File "./my_oauth2_gather_key.py", line 41, in set_code
self.oauth.fetch_access_token(code, self.redirect_url)
File "~/fitbit/python-fitbit/fitbit/api.py", line 274, in fetch_access_token
code=code)
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 199, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 409, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 376, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 386, in validate_token_parameters
raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
getter
is an object that handles the generation of access token url and the passing back of the code to get new access and refresh tokens.
It errors at the point when trading in the fitbit code for tokens. In other words,
access token url is okay, the user has provided permission, fitbit issue the callback with the necessary code.
The same exact code works on f0166f6.
I am not sure how to explain it...
from python-fitbit.
@randi120 I've tested both, first using an existing app and by registering a new dummy app. Both worked for me. Apologies for not being able to offer more insight to your problem.
from python-fitbit.
@JamesGardiner yeah. is a weird issue...
thanks.
from python-fitbit.
I've had issues in the past where I would get authorization issues if I didn't set the "redirect URL" in Fitbit to match up with what the OAuth API was using. Make sure that if you specify "localhost" as the redirect URI that you have "localhost" as the redirect URI in your fitbit application settings.
from python-fitbit.
@randi120 I was having the same error as well but not anymore. Have you tried to install requirements in a new virtual environment? After you do that, test the package again. Also, what is the installed version of requests-oauthlib
? Is it 0.6.1
?
from python-fitbit.
@PertuyF If you don't have this issue anymore, can we close the issue?
from python-fitbit.
@percyperez, Thank you!
upgrading requests-oauthlib to 0.6.1 fixed the issue for me.
from python-fitbit.
oauthlib.oauth2.rfc6749.errors.MissingTokenError
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
if 'code' not in request.args and 'state' not in request.args:
return redirect(url_for('login'))
else:
google = get_google_auth(state=session['oauth_state'])
try:
token = google.fetch_token(Auth.TOKEN_URI,client_secret=Auth.CLIENT_SECRET,authorization_response=request.url)
except HTTPError:
return 'HTTPError occurred.'
google = get_google_auth(token=token)
resp = google.get(Auth.USER_INFO)
Open an interactive python shell in this frame if resp.status_code == 200:
plz help me ,how to solve this
from python-fitbit.
Related Issues (20)
- Problems with Auth 2.0 HOT 3
- Help needed?
- How to get activity statistics by activity type when its started from the tracker?
- unable to get sleep summary data using time_series('sleep') HOT 2
- Source tarball on PyPi does not include tests or tox config
- Error trying to get heart data HOT 4
- Close Chrome tab after validating API HOT 3
- AttributeError: module 'fitbit' has no attribute 'Fitbit' HOT 1
- Works well Locally, but not Deployed
- Add multi-date functionality
- Force sync HOT 1
- wait_for_tstate_lock: ENGINE Waiting for thread Thread-4
- fitbit do not allow callback URLs with http anymore HOT 2
- Add lifetime stats, friends and badges API HOT 1
- [INFO] Repo not maintained anymore ? HOT 13
- Unable to establish connection with Fitbit API
- Exporting Breathing Rate Intraday by Date HOT 10
- urllib failure
- TCX endpoint decoding error error
- Download Skin Temperature and SpO2 data HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-fitbit.