A simple Deno app that fetches your currently playing or most recently played song and renders it as a svg. This allows you to embed it anywhere that supports svg, including GitHub README
as you can see above!
- Navigate to https://developer.spotify.com/dashboard/applications and create an account if you do not already have one.
- Create a new app
- Copy
Client ID
andClient Secret
into your.env
file. - In your app page client
Edit Settings
and fill in your website and Redirect URI. Copy your redirect uri. - Construct an authorization url in the format
https://accounts.spotify.com/authorize?response_type=code&client_id=$CLIENT_ID&scope=user-read-recently-played,user-read-currently-playing&redirect_uri=$REDIRECT_URI
and paste it into your browser window.- Additional scopes that could be useful but not required:
user-read-playback-state,playlist-read-private,user-read-playback-position,user-top-read,user-library-read
- Additional scopes that could be useful but not required:
- Copy
code
url parameter from redirected url after navigating through oauth2 flow. - Run
curl -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET -d grant_type=authorization_code -d code=$CODE -d redirect_uri=$REDIRECT_URI https://accounts.spotify.com/api/token
- Copy
refresh_token
into.env
file.
Deployments to Deno Deploy occur on pushes to master
.
- Create project in deno deploy.
- Set
SPOTIFY_CLIENT_ID
,SPOTIFY_CLIENT_SECRET
,SPOTIFY_REFRESH_TOKEN
environment variables. - Set
DENO_DEPLOY_TOKEN
in repository secrets. - Set
DENO_DEPLOY_PROJECT
in repository variable to your project name from step #1.
Environment variables can either be set directly on your local environment, or via a .env
file. Copy .env.example
into .env
and add your values.
Name | Description |
---|---|
SPOTIFY_CLIENT_ID | OAuth2 Client ID |
SPOTIFY_CLIENT_SECRET | OAuth2 Client Secret |
SPOTIFY_REFRESH_TOKEN | OAuth2 Refresh Token |
- Add some extra logging
- Clicking on the svg should redirect you to a react/preact version that is dynamic