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

Problems with oauth_callback

ANSWERED

I'm trying to authenticate myself in a FitBit Application using Python. I read API documentation and follow the main steps. So I:

  1. Create my FitBitOauthClient() instance with

    client = fitbit.FitbitOauthClient(KEY,SECRET)
  2. client.fetch_request_token()

    client.fetch_request_token()
  3. 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!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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')
Ivan Bahdanau
Senior Software Developer at Fitbit

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

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')
Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Thank you very much ibahdanau!

Best Answer
0 Votes