Coder Social home page Coder Social logo

Comments (2)

brad avatar brad commented on July 29, 2024

Hi @karthikarul20
I think I am to blame for your troubles. If there was better documentation it probably would be easier for you.
So a couple things:

  • The authorize url you are using is wrong, the base should be www.fitbit.com instead of api.fitbit.com.
  • There is no need to build the authorize url yourself, we have a function for that; authorize_token_url. I've included some example code below.
  • The most recent version of the library changed the user_key and user_secret kwargs to resource_owner_key and resource_owner_secret respectively, but None is the default so they don't need to be specified here.
  • Fitbit will only redirect to your callback_uri if the app type on dev.fitbit.com is "Browser"
  • Now that you have publicly posted your Fitbit app key/secret, I highly recommend you reset them.
import webbrowser
from fitbit import Fitbit

client_kwargs = {
    'client_key': 'c8ca82f890c44a969cc3524b7c342e8b',
    'client_secret': '7bf3dd8b933144e2bbe2c7971d46e3ae',
    'callback_uri': 'http://127.0.0.1/test'
}
fb = Fitbit(**client_kwargs)
fb.client.fetch_request_token()
webbrowser.open(fb.client.authorize_token_url())

Let me know how that works out for you.

from python-fitbit.

karthikarul20 avatar karthikarul20 commented on July 29, 2024

Thanks Brad. App type on dev.fitbit.com was the culprit. It was set as Desktop and now it works fine.
Also i have reset the client_key and client_secret as you recommended.

from python-fitbit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.