MMM-fitbit icon indicating copy to clipboard operation
MMM-fitbit copied to clipboard

404 Error, cannot get refresh tokens

Open moshinh opened this issue 8 years ago • 5 comments

I am having the same issue Greppie had at some point.

Next thing ist, that setupAccess.py doesnt work or I did not understood how it does. The script start a server at port 8080 but if fitbit redirects to it I get an error that the page is not accessible. However I copied the token from url an put it into tokens.ini. There's only an access token and no refresh token, right?

I am having this same problem, I get a 404 error on the attempt to get my tokens. I was able to pull the token from the URL, but have no way to get the refresh. Please help, im so close! Thanks for all of your effort.

When I click the autogenerated authorization URL, I am redirected to http://127.0.0.1:8080/ and throw this 404 error.

404 Not Found

Missing parameters: state

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 67, in __call__
    raise sys.exc_info()[1]
HTTPError: (404, 'Missing parameters: state')

moshinh avatar Oct 25 '16 15:10 moshinh

This is what I see when I run setupAccess.py

Is this part normal?

CherryPy Checker:
The Application mounted at '' has an empty config.

Full output:

pi@mirror:~/MagicMirror/modules/MMM-fitbit/python $ sudo python setupAccess.py 
Get credentials from credentials.ini? (Y/N)
n
Would you like to enter them manually now? (Y/N)
y
Enter client id:
227WT7
Enter client secret:
9fe3da42b609603a67e7730aad3ca96a
[25/Oct/2016:11:20:26] ENGINE Listening for SIGHUP.
[25/Oct/2016:11:20:26] ENGINE Listening for SIGTERM.
[25/Oct/2016:11:20:26] ENGINE Listening for SIGUSR1.
[25/Oct/2016:11:20:26] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[25/Oct/2016:11:20:26] ENGINE Started monitor thread 'Autoreloader'.
[25/Oct/2016:11:20:26] ENGINE Started monitor thread '_TimeoutMonitor'.
[25/Oct/2016:11:20:27] ENGINE Serving on http://127.0.0.1:8080
[25/Oct/2016:11:20:27] ENGINE Bus STARTED
127.0.0.1 - - [25/Oct/2016:11:20:40] "GET / HTTP/1.1" 404 1206 "" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.91 Safari/537.36"

moshinh avatar Oct 25 '16 15:10 moshinh

Unfortunately, I am using code provided by those at python-fitbit so cannot provide detailed help! I'll check my output from setupAccess.py when I can but am moving house right now so can't use my mirror.

SVendittelli avatar Dec 15 '16 23:12 SVendittelli

@SVendittelli Would it not be possible to use a console based web browser for the setupAccess.py? I'm currently trying this out on a Ubuntu Server 14.04 (LXC) so I don't have any "GUI" to use. :)

Snille avatar Dec 19 '16 13:12 Snille

I am happy to use one if you can get it working, show me a working example and I'll happily add it to the repo

SVendittelli avatar Dec 19 '16 13:12 SVendittelli

@SVendittelli It seems that Lynx (console based browser) can't handle the web page unfortunately. Guess I'll have to set it up later on. :)

Snille avatar Dec 19 '16 14:12 Snille