Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get nrc token there maybe a better way. #1

Open
yihong0618 opened this issue Jul 5, 2020 · 4 comments
Open

Get nrc token there maybe a better way. #1

yihong0618 opened this issue Jul 5, 2020 · 4 comments

Comments

@yihong0618
Copy link
Collaborator

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.

@yihong0618 yihong0618 changed the title Get nrc token maybe has a better way. Get nrc token there maybe a better way. Jul 5, 2020
@yasoob
Copy link
Owner

yasoob commented Jul 5, 2020

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
Copy link
Collaborator Author

@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
Copy link
Collaborator Author

@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
Copy link
Collaborator Author

yihong0618 commented Nov 11, 2020

@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~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants