Stu Mason
Stu Mason

Activity

Issue Opened

Issue #19 opened: Sync fails with HTTP 403 when fetching Sleep data (Accesslink API)

What happened?

While running the polar-flow-server on a Raspberry Pi (ARM64) via a native build, the synchronization process completes with a 200 OK status in the logs, but the actual data request to the Polar Accesslink API for sleep data returns a 403 Forbidden error.

Steps to reproduce

  1. Setup polar-flow-server using the production docker-compose.
  2. Link a Polar account.
  3. Trigger a sync via the /admin panel.
  4. Observe logs during the "Starting sync" event.

Expected behaviour

The server should either:

  1. Successfully fetch sleep data if scopes are correct.
  2. Provide a clear error message in the logs/UI if the API returns a 403 (Forbidden), suggesting a check of API scopes or user consent.

Environment

  • Host: Raspberry Pi (ARM64)
  • OS: Debian Trixie
  • Deployment: Docker (Native ARM64 build)
  • Image: polar-flow-server (latest source)

Logs / Error messages

INFO - 2026-01-20 16:13:59,145 - polar_flow_server.services.sync - sync - {"service": "sync", "user_id": "61516231", "days": 30, "event": "Starting sync", "level": "info", "logger": "polar_flow_server.services.sync", "timestamp": "2026-01-20T16:13:59.145497Z"}
INFO - 2026-01-20 16:13:59,476 - httpx - _client - HTTP Request: GET https://www.polaraccesslink.com/v3/users/sleep?from=2025-12-24&to=2026-01-20 "HTTP/1.1 403 "
INFO:     192.168.0.80:59560 - "POST /admin/sync HTTP/1.1" 200 OK
INFO:     192.168.0.80:59560 - "GET /admin/api/charts/sleep?days=30 HTTP/1.1" 200 OK

Additional context

Thanks for developing this, looks very promising!