trazfr / freebox-exporter

Prometheus exporter for the Freebox
MIT License
20 stars 9 forks source link

No request for authorization (api_version invalid ?) #12

Closed Epy closed 5 months ago

Epy commented 5 months ago

Hello I'm trying to make this nice project work. (Freebox is in bridge mode)

I have some issues with authorization:

With mDNS detection I get a timeout after 1 second, without any firewall between my container and the Freebox. (Using a Proxmox LXC) With -httpDiscovery it does wait a little, without the message asking to authorize access on the Freebox screen, around 5s and then stop.

# bin/freebox-exporter -debug -httpDiscovery token.json
INFO: 2024/04/17 17:11:42 collector.go:641: Could not find the configuration file token.json
INFO: 2024/04/17 17:11:42 api_version.go:106: Freebox discovery: GET http://mafreebox.freebox.fr/api_version
DEBUG: 2024/04/17 17:11:42 api_version.go:55: APIVersion &{XXXXXXXXXX.fbxos.fr -------------------------------- true 32772 Freebox 10.2 /api/ FreeboxServer1,2 10}
DEBUG: 2024/04/17 17:11:42 http_client.go:80: HTTP request: POST /api/v10/login/authorize/

[around 5s wait here]

panic: Post "https://XXXXXXXXXXX.fbxos.fr:32772/api/v10/login/authorize/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
main.NewCollector({0x7ffe41819738, 0xa}, 0x6?, 0x9dd23d?, 0x0, 0x0?)
    /opt/freebox-exporter/pkg/mod/github.com/trazfr/freebox-exporter@v0.0.0-20240325205226-199a4ea05c19/collector.go:645 +0x454
main.main()
    /opt/freebox-exporter/pkg/mod/github.com/trazfr/freebox-exporter@v0.0.0-20240325205226-199a4ea05c19/main.go:56 +0x2e5

I checked api version with the link, its 10.2, correctly detected by your software but http://mafreebox.freebox.fr/api/v10/ answers: "invalid_api_version" and http://mafreebox.freebox.fr/api/v10/login/authorize/ "invalid_request"

curl --insecure https://mafreebox.freebox.fr/api_version and curl --insecure https://mafreebox.freebox.fr/api/v10/login/ work from the container.

Maybe something has changed on their side ? I can't know if there is something happening on the freebox screen, I would need around 30s to go there

Thank you !

Epy commented 5 months ago

I just found this: Freebox

"Permettre les nouvelles demandes d'autorisation" was unchecked. And after a lot of fidgeting with connection problems, I managed to get the application accepted by the freebox. That could help someone else maybe.

Sorry for the noise