/spotify-web-api-access-token

Spotify Web API Access Token

Primary LanguageTypeScriptMozilla Public License 2.0MPL-2.0

Spotify Web API Access Token

Endpoints

  • Home (/): Display retrieved data or when invalid redirects to Login
  • Login (/login): Request User Authorization by redirecting to Spotify Login which will in turn redirect to Callback
  • Callback (/callback): Don't access manually, Spotify will redirect here and if successful redirects to Access
  • Access (/access): Request Access Token and save data temporarily then redirects to Home
  • Refresh (/refresh): Request a refreshed Access Token and save data temporarily then redirects to Home

Usage

Deno

deno task start-deno

NodeJS

npm i
npm run start-node

Example of using the requested Access Token

Get playlists of current user, filter by public, collaborative and user id and only show name, owner display name, public and collaborative fields

TOKEN="" # paste your token between the quotes
LIMIT="50"
OFFSET="0"
curl -Ls -H "Cache-Control: no-cache" -H "Authorization: Bearer ${TOKEN}" "https://api.spotify.com/v1/me/playlists?limit=${LIMIT}&offset=${OFFSET}" | jq '.items[] | select((.public or .collaborative) and (.owner.id | ascii_downcase) == "masterflitzer") | { name, owner: .owner.display_name, public, collaborative }' | less