If you have multiple Google account registered in chrome/chromium, fitbit authentication in Step 4 will fail if your default account is not the one you used to create developer app. It returns the same errors you get when using wrong URL or with SSL problem.
After I realize that, I used another profile with the google account used in fitbit as default and all worked perfectly. I think incognito mode or another browser less integrated in google ecosystem will solve the same way.
My FitBit Integration was working until yesterday, 20/05/20 and this was prior to the Home Assistant 0.110.0 update but I did update NGINX, not sure if that was the cause but I suddenly lost all my sensors.
I am now trying to re authorise but coming up with
also even though I have DuckDNS and NGINX running I still get the callback
Same troubles as above. I’ve tried using my standard hassio site through reverse proxy, bypassing proxy by port forwarding 8123 through my domain, tried using nabu casa url, nothing, Fitbit configurator still links me to my internal IP.
base_url is also included, in case anyone asks!
getting one step closer, however, appending /api/fitbit to the end of all three methods does indeed give me the fitbit authorization site, though accepting it immediately ends with error 500, but no sensors to speak of.
I’ve gone as far as clearing cached data just in case that was somehow playing a role, and got zilch.
someone must’ve breathed on the code and broke it again
How? Can you explain the exact steps you’ve followed? I also got it as far as the ‘500’ message. But i’m stuck now. I reached the checkboxes to allow some at:
Yesterday I updated HA to 111 and HassOS to 4.10.
Wrote NabuCasa both external and internal url.
After these procedures, I was able to create an App and log in
Same issue here.
Depends from URL.
If i choose my ip:8123 the error is: invalid_request - Invalid redirect_uri parameter value
If i choose duckdns.org:443 the error is: 503
I tried using @AlexKalopsia 's solution. Unfortunately Home Assistant still has the configure pop up window saying “Please authorize Fitbit by visiting http://…/api/fitbit”, so I can’t get past step 0. Is there a fix for this?
I fixed this by going to sensor.py and changing the get_url function call to use get_url(hass, allow_internal=False). Took a few minutes, but the default behavior of this call is to return the hass internal URL I am using Home Assistant Cloud. Given the nature of fitbit integration, the devs might want to change the default behavior in sensor.py. my $.02.
Update: I am using Portainer on WDPR2100, Docker HA (not HASS.IO), and the path for sensor.py is /usr/src/homeassistant/homeassistant/components/fitbit/sensor.py.
I think I have found a fix for this now after having to go through authorisation again.
My API is set up to use a https://duckdns:8123 address but the configuration page on HA gives a local IP address and changing this to the duckdns address throws the following error -
Developer information: invalid_request - Invalid redirect_uri parameter value
If you look in the browser address at the top of the fitbit API page you will see the local 192.168 etc address in there so I changed that address to the duckdns address and that worked for me. See the example below -
The address above is much longer than I have pasted so you just need to change the local IP address to your https callback address you have configured in the API.
I figured out that I should change the fitbit URL address, but it’s still not working for me. I get a 500 error. Here’s the logs:
2021-01-05 02:30:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 126, in handle
result = handler(request, **request.match_info)
File "/usr/src/homeassistant/homeassistant/components/fitbit/sensor.py", line 360, in get
redirect_uri = f"{get_url(hass, require_current_request=True)}{FITBIT_AUTH_CALLBACK_PATH}"
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 123, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError
What error, if any, do you get on the Fitbit API page that I state above ? Is there any new data in the fitbit.conf file apart from your secret and id ?
No error, I’m able to access the URL and allow the app. No new data besides secret and ID. That’s because my error is on line 360 and saving the file happens at a later point.