Skip to content

Getting JWT token with KS Fit app and with google account login #20

@kirankunigiri

Description

@kirankunigiri

Hi! This project is great. I currently use the KS Fit International app and made my account with the google login integration, so I was not able to use the python script to login with my account email/password. I decided to figure out how to get the JWT token from the KS Fit app, since you mentioned you used the Walkingpad app instead. After some trial and error, I was able to figure it out! I thought I would leave that information here for anyone else who is also using google login or the KS Fit App.

However, I later realized that the JWT token only works with KS Fit and not the Walkingpad app that this project is for (read more about this at the bottom). But this is still useful anyways because the endpoints seem to have similar functionality.

  1. Install the HTTP Toolkit app on your computer, then connect your phone with adb. On your computer, select the adb option and it should automatically start showing all http requests from your phone. You do not need a rooted phone, it worked for me without it - just make sure to follow the steps and install the CA certificate.
  2. Open the KS Fit app, and you should already see http requests being made to https://eu.api.ks.fit/V0.1/index.php. Open up any of the requests, and you will see a JSON object similar to the following:
{
  "service": "record.GetAllRecords",
  "xjid": "<number>",
  "run_id": "<number>",
  "token": "<your_jwt_token>"
}
  1. The python script in this repo uses a different endpoint, but it seems like KS Fit app uses eu.api.ks.fit v0.1 and you can target different endpoints with the "service" keyword. You can now copy the JWT token!

Now, I am able to make requests with Postman to get my record data. Using the record.GetAllRecords service endpoint gives me my full workout history data, which is what I needed. I plan to use this to build a service to automatically sync my data to Google Fit/Samsung Health since the existing Google Fit integration on this app is broken for me and doesn't sync older data.

However, this JWT token doesn't work with the https://eu.app.walkingpad.com API endpoint which this project uses. I tried testing the get_records function from the upload.py file but I got this error message: {'code': 13, 'message': '请先进行登录'} so I think the account system may be completely different between the Walkingpad and KS Fit app. So even though this method won't work for this project, regardless I thought this information may be useful in the future if trying to expand to the KS Fit app as well, so I wanted to leave this here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions