yasoob / nrc-exporter

Download your runs data from Nike Run Club and convert it to GPX format that can be imported in other running apps.
https://yasoob.me/posts/reverse-engineering-nike-run-club-using-frida-android/
MIT License
120 stars 14 forks source link

Get nrc token there maybe a better way. #1

Open yihong0618 opened 4 years ago

yihong0618 commented 4 years ago

Hi~, I am also fond of running and programing. And I search github for nrc json to gpx find your repo, that is very cool and useful. And I recently research some nrc payload and to automate my running, I think there seems another way for your nrc get token way because the token will expire sometime which is a little different for github action. I found nrc has a url can use refresh_token to exchange the token, which you can login--> logout --> login find in this url below image

Using refresh_token you can use payload like this code to get the token, and the refresh_token will not expire

TOKEN_REFRESH_URL = "https://unite.nike.com/tokenRefresh"
NIKE_CLIENT_ID = "HlHa2Cje3ctlaOqnxvgZXNaAs7T9nAuH"
response = requests.post(
    TOKEN_REFRESH_URL,
     json={
         "refresh_token": refresh_token,
         "client_id": NIKE_CLIENT_ID,
         "grant_type": "refresh_token",
            },
       )

Using this way you can write a github action or something using nrc to run and using your script to upload the gpx to strava or runtastic or runkeeper to synchronize your running data.

Thank you for your repo again.

yasoob commented 4 years ago

I am having slight difficulty figuring out how this might be useful. The whole extraction process happens within a couple of seconds (or couple of mins at max) so refreshing the token is not strictly required.

Can you list a scenario where this might be useful? It would be nice if you can talk about the GitHub action workflow in a bit more detail as well. I am definitely interested in learning more about this.

yihong0618 commented 4 years ago

@yasoob Like you can daily backup your nrc running and generate some satatic web site in githup action, you can see it from mine, https://github.com/yihong0618/blog/blob/master/.github/workflows/nike_sync.yml https://github.com/yihong0618/blog/blob/master/scripts/nike_sync.py And you can use nrc to run and automatic upload to strava after you run, I'm working on it ~

yihong0618 commented 4 years ago

@yasoob Done using refresh token you can write some github action with scripts and cronjob like mine https://github.com/yihong0618/blog/blob/master/.github/workflows/nike_sync.yml Which can using NRC to run and auto upload to strava.

yihong0618 commented 3 years ago

@yasoob Using refresh token to get daily run using GItHub Actions and I make a repo called running_page using some of nrc-exporter code~