AutoStepLogger is a simple toolkit that helps users upload simulated steps to a Fitbit account (for example, automatically upload 10,000 steps every day). This repository contains two main scripts:
fitbit_login.py— Run locally to perform OAuth login and producefitbit_tokens.json(access + refresh token).fitbit_host.py— Run on a host (e.g. PythonAnywhere) to readfitbit_tokens.jsonandfitbit_config.json, refresh tokens when required, and upload steps.fitbit_config.json— Configuration template (replace with your own credentials).
Prerequisites
- Python 3.8+
- requests:
pip install requests - A Fitbit developer application: https://dev.fitbit.com/apps/new
Quick Overview
- Register a Fitbit application (https://dev.fitbit.com/apps/new), add
http://127.0.0.1:8080/as Redirect URL, and copy your OAuth 2.0 Client ID and Client Secret value. - Fill
fitbit_config.json(OAuth 2.0 Client ID value and Client Secret value) with your credentials. - Run
fitbit_login.pylocally to authorize and generatefitbit_tokens.json. - Upload
fitbit_host.py,fitbit_config.json, andfitbit_tokens.jsonto your host (e.g. PythonAnywhere). - Schedule
fitbit_host.pyto run daily.
Step 0 — Create a Fitbit App
- Go to https://dev.fitbit.com/apps and create a new app (or edit an existing one).
- Add Redirect URL:
http://127.0.0.1:8080/(must exactly match the redirect_uri used by the login script). For example:
- Save and copy the
OAuth 2.0 Client IDandClient Secret value!!!! and paste values tofitbit_config.json.
Step 1 — Prepare config (local)
Edit fitbit_config.json in the project directory and fill in your values. Example:
{
"client_id": "Your_OAuth 2.0 Client ID",
"client_secret": "Your_Client_Secret",
"redirect_uri": "http://127.0.0.1:8080/",
"scope": "activity",
"default_port": 8080,
"daily_steps": 10000,
"start_time": "08:00"
}Step 2 — Run local login to obtain tokens
- Install requests if needed:
pip install requests - Run:
python fitbit_login.py - The script opens your browser to the Fitbit authorization page. Sign in and click "Allow".

- The local server will capture the authorization code and exchange it for tokens.
- The script writes
fitbit_tokens.json. Keep this file private. - You can try to run the
fitbit_host.py. It should increase 10k steps on your Fitbit.
Step 3 — Prepare host environment (this example uses PythonAnywhere)
- Register a PythonAnywhere account
- Click the
Dashboard->Filespage - Click
New file - Upload these files to your host:
fitbit_host.pyfitbit_config.json(with your client_id/client_secret)fitbit_tokens.json(from Step 2)
- — Schedule daily run
Client the
Tasks→ Scheduled tasks
- Command:
python3 /home/yourusername/fitbit_host.py - Remember PythonAnywhere uses UTC. Convert your desired time to UTC. (UTC 2:00 am = HK time 10:00 am). If you don't understand, just fill 2:00
Common issues & troubleshooting
- invalid_request - Invalid redirect_uri parameter value:
- Ensure the redirect URI you registered on Fitbit exactly matches
redirect_uriinfitbit_config.json(include trailing slash and port).
- Ensure the redirect URI you registered on Fitbit exactly matches
- No code after clicking Allow:
- Confirm your local server is listening on the same port defined in
redirect_uriand that no firewall blocks it.
- Confirm your local server is listening on the same port defined in
- Refresh token fails:
- If refresh_token is revoked or expired, re-run
fitbit_login.pylocally to obtain a newfitbit_tokens.json.
- If refresh_token is revoked or expired, re-run
License
- MIT