11-03-2014 07:44
11-03-2014 07:44
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.
11-03-2014 08:20 - edited 11-03-2014 08:50
11-03-2014 08:20 - edited 11-03-2014 08:50
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')
11-03-2014 08:20 - edited 11-03-2014 08:50
11-03-2014 08:20 - edited 11-03-2014 08:50
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')
11-03-2014 08:41
11-03-2014 08:41
Thank you very much ibahdanau!