A simple server for authorizing Spotify-based client applications. The official OAuth flow is available here. Image by @carltraw
Head over to their dashboard. Log in with your Spotify account, create a Client ID, and register a Redirect URI
set to http://localhost:3001/oauth.
This URI is where Spotify will return the user upon successful OAuth.
Create a .env
file at the root of this repo, and fill out your Spotify client params:
SPOTIFY_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SPOTIFY_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
You can do this using either Docker or Go:
To use this method, you'll need to have Docker installed on your machine.
# build the container
$ docker build -t [NAME] .
# run the built image
$ docker run -p [PORT]:3001 [NAME]
You can use any name you want, as well as the port you want it to run on your machine. For example:
# build the container
$ docker build -t good-vibes-only-server .
# run the built image
$ docker run -p 4444:3001 good-vibes-only-server
# test that it's responsive
$ curl localhost:4444/alive
=> "ok"
To use this method, you'll need have the Golang toolchain installed on your machine.
# start app
$ go run .
# healthcheck
$ curl localhost:3001/alive
# get spotify login URL
$ curl localhost:3001/login
You can write your own client, but if you'd like to see a live example that uses this server, check out the client repo.