11-03-2014 07:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-03-2014 07:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm trying to authenticate myself in a FitBit Application using Python. I read API documentation and follow the main steps. So I:
Create my FitBitOauthClient() instance with
client = fitbit.FitbitOauthClient(KEY,SECRET)
client.fetch_request_token()
client.fetch_request_token()
Open browser for "allow" my application in my FitBitAccount
webbrowser.open(client.authorize_token_url())
And here there is my problem. When I allow the application (in browser), FitBit gives me a "VERIFICATION" code and I must Copy&Paste it in my application. I now that there is a function calls "callback" which can do this step (copy&paste code) alone without user. I can't to correctly set "callback" because I'm not able to catch "verification code" in request. I need that once I press the button I can save "verification code" somewhere.
This function doesn't work because I don't know how read Verification code
client = fitbit.FitbitOauthClient(CLIENT_KEY,CLIENT_SECRET,callback_uri='http://www.fitbit.com')
Thanks!
Answered! Go to the Best Answer.

- Labels:
-
OAuth 1.0a
Accepted Solutions
11-03-2014 08:20 - edited 11-03-2014 08:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-03-2014 08:20 - edited 11-03-2014 08:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
To read verification code you need web server that will do that for you.
The callback url is not fitbit.com, it's your server url.So fitbit will make request to your server and send verification code. Your server should be able to read it as it will be just a simple request parameter.
client = fitbit.FitbitOauthClient(CLIENT_KEY,CLIENT_SECRET,callback_uri='http://www.youServerUrl.com')
Senior Software Developer at Fitbit

11-03-2014 08:20 - edited 11-03-2014 08:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-03-2014 08:20 - edited 11-03-2014 08:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
To read verification code you need web server that will do that for you.
The callback url is not fitbit.com, it's your server url.So fitbit will make request to your server and send verification code. Your server should be able to read it as it will be just a simple request parameter.
client = fitbit.FitbitOauthClient(CLIENT_KEY,CLIENT_SECRET,callback_uri='http://www.youServerUrl.com')
Senior Software Developer at Fitbit

11-03-2014 08:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-03-2014 08:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you very much ibahdanau!

