This is a loantokenshark service for Spotify API tokens.
While using my phone as the driver for example Android Auto. I want someone to be able to control the music on my device. Someone should not need to use my phone that's tethered to the car. Let's lend them my access token.
Yes, it's possible to control from there. Maybe even play/pause or skip songs from the wheel.
But browsing playlists, choosing artists or searching for music is often a real pain on those screens. It would be much nicer experience for someone to be able to use another device.
We could set up a session each time, it would be nice to just setup once. It's great for other scenarios.
The idea is quite simple:
- User A store their
refresh token
in the service. - User A gives User B the right to use it
- User B requests an
access token
for User A by providing a personalrefresh token
to Spotify API - Service checks who User B is against Spotify API (instead of having own auth)
- Service validated that User B indeed have the rights to get a token for User A
- Service send User B an
access token
issued for User A - Finally User B uses that token towards Spotify API controlling music for User A
Project will be at ctrl.name.
- Postgresql database
- Create a Spotify API client here https://developer.spotify.com/dashboard
- Create
.env
filecp env.example .env
- Fill in
.env
with your details.
- Build the project
go build -o builds/server server/server.go
- Run the project
./builds/server
I'm new to Go, so keep that in mind while reading the code. HUGE thanks to @sikevux for answering my stupid questions.