Closed urandom2 closed 7 years ago
I'm not sure where that verify call is coming from:
$ strings dev/helvetic/firmware/firmware-35.dat | grep verify
$ strings dev/helvetic/firmware/firmware-39.dat | grep verify
But there is a /validate
call, maybe you mean this?
$ strings dev/helvetic/firmware/firmware-35.dat | grep scale/
...SNIP...
/scale/upload
/scale/register?serialNumber=%02X%02X%02X%02X%02X%02X&token=%.31s&ssid=
/scale/validate?serialNumber=%02X%02X%02X%02X%02X%02X&token=%.31s
/scale/register
/scale/validate
/scale/firmware
/scale/ssid_info.js
...SNIP...
There's also similar hits in the V39 firmware. I don't have a V37 firmware to compare, though.
I don't recall seeing /scale/validate
hits, but it would have been a while ago (2014) that I last tried to configure this.
I'm not sure where those hits are coming from though. I'm half tempted just to have a /scale/validate
endpoint that always returns T
, because the only thing we actually care about in the process is /scale/register
.
(Also aware that firmware/
is missing from the repo -- they're binary blobs that aren't mine to publish. There's details on how to acquire it with firmware.md
.)
My theory would be that /scale/register
is run as an asynchronous process on the real Fitbit server, and then /scale/validate
is a callback in order to make sure the transaction was actually processed.
Because ScaleRegisterView does the entire process synchronously and would throw a non-200 response code in the event of a failure, we can always shortcut that part of the process.
Yeah, I mistyped the endpoint name; it is now fixed.
I agree that an endpoint that always returns 200 OK
"T", is probably the cleanest solution, despite it being inaccurate to the api name scale/validate
, but we are limited to the poor choices that fitbit made.
While playing around with this tool set, I realized that for my scale (tested on v37 and v39) the scale hit the
scale/register
endpoint, then thescale/validate
endpoint; this code (inhelvetic/views/aria_api.py
) seems to solve the problem:But, when I log the traffic between the scale and the actual endpoint, it never queries
scale/verify
; prototyping was done by manually hitting this endpoint:http://fitbit.com/scale/verify?serialNumber=<serial_number>&token=<token>
This always returns a200 OK
with the characterF
as the body, I assumed that this this was the failure state, swapped it to aT
and kept the200 OK
. Finally I do not like the danglingauth_token
, but sincescale/verify
needs it, there does not appear to be any other way.PR can be generated upon request.