Bleedmagic/-box

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatic update pinned gist to show your recent top tracks.

Don't forget to leave a ⭐ if you found this useful.


πŸ“Œβœ¨ For more pinned-gist projects like this one, check out: https://.com/matchai/awesome-pinned-gists

This code was heavily inspired by @jacc's music-box.

  1. Create a new public Gist (https://gist..com/)
  2. Create a token with the gist scope and copy it. (https://.com/settings/tokens/new)
  3. Create a Application and get certified, detail steps you can see below.
Authorization Steps

Visit https://developer..com/dasard/applications login and create a new Application

After create, you will get your Client ID & Client Secret.

Then click EDIT SETTINGS Button, add http://localhost:3000 to Redirect URIs

Visit following URL after replace $CLIENT_ID to yours

https://accounts..com/en/authorize?client_id=$CLIENT_ID&response_type=code&redirect_uri=http:%2F%2Flocalhost:3000&scope=user-read-currently-playing%20user-top-read

Agree to this application to access your info, after that your will be redirect to a new page, the url like this: http://localhost:3000?code=$CODE

this $CODE is your Authorization Code, it will be used to generate access_token at next step.

the last step, use the $CLIENT_ID and $CLIENT_SECRET from step 1, $CODE from step 2 to replace the shell command below

curl -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET -d grant_type=authorization_code -d code=$CODE -d redirect_uri=http://localhost:3000 https://accounts..com/api/token

after run it at your terminal, you'll get your ${REFRESH_TOKEN}

the output may like this:

{
    "access_token": "BQBi-jz.....yCVzcl",
    "token_type": "Bearer",
    "expires_in": 3600,
    "refresh_token": "AQCBvdy70gtKvnrVIxe...",
    "scope": "user-read-currently-playing user-top-read"
}

if the response not return refresh_token, back to step 2 and retry.

  1. Fork this repo
  2. Go to your fork's Settings > Environments > New environment and create an environment called "prod"
  3. Choose your "prod" environment and Add Secret for each environment secret (below)
  4. Enable Actions on your fork via the 'Actions' tab
  5. Enable the '-box' Workflow via the 'Actions' tab
  6. Kick off a workflow run of the '-box' Workflow via Actions > -box > Run workflow
  • GIST_ID: The ID portion from your gist url https://gist..com/< username>/6d5f84419863089a167387da62dd7081.
  • GH_TOKEN: The token generated above.
  • _CLIENT_ID: The Client ID you got from Developer Dasard.
  • _CLIENT_SECRET: The Client Secret you got from Developer Dasard.
  • _REFRESH_TOKEN: The Refresh Token you got from API.

Feel free to use the Sponsor button to donate towards my work if you think this project is helpful. πŸ€—

About

🎢 Automatic update pinned gist to show your recent top tracks.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages

  • JavaScript 100.0%