Skip to content

nextempire/spotify-token-swap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Token Swap Service for Heroku

To use the new Spotify SDK we are required to run our own Token Exchange Service. This repository provides you with an easy installation on Heroku. The current CLIENT_ID, CLIENT_SECRET and CLIENT_CALLBACK_URL are straight from Spotifys Repo and work with their example apps.

Setup

Unless you are expecting massive traffic, the free plan will work for you. Be patient, it can take up to 60 min until you get the confirmation Mail from Heroku.

git clone https://github.com/simontaen/SpotifyTokenSwap.git
cd SpotifyTokenSwap

From here on forward it's basically following the Getting Started Guide.

heroku create --http-git
git push heroku master
heroku ps:scale web=1
heroku logs --tail
  • Verify its running
curl https://peaceful-sierra-1249.herokuapp.com

and you should get a <h1>Not Found</h1> back. Also check the logs should show something like

app[web.1]: ip-10-147-165-35.ec2.internal - - [<timestamp>] "GET / HTTP/1.1" 404 18
app[web.1]: - -> /
app[web.1]: <your-ip> - - [<timestamp>] "GET / HTTP/1.1" 404 18 0.0005
heroku[router]: at=info method=GET path="/" host=peaceful-sierra-1249.herokuapp.com <...>

Or run the Spotify examples with a corrected kTokenSwapServiceURL and kTokenRefreshServiceURL.

  • Your own app

As mentioned above the current code is configured to what Spotify provided us. So you need to syncronize the CLIENT_ID, CLIENT_SECRET and CLIENT_CALLBACK_URL between your Spotify Account, your iOS App and the spotify_token_swap.rb.

Run Locally

bundle install
foreman start

foremanis part of the Heroku Toolbelt.

Convenience

I personally will host an instance on Heroku for public use as it is very annoying to go through setting everything up when you just want to try something with the SDK. I'll keep it on the free plan and won't pay much attention to it. We'll see how it goes but if the service it getting slammed it'll crash, so be polite.

https://peaceful-sierra-1249.herokuapp.com/swap
https://peaceful-sierra-1249.herokuapp.com/refresh

About

Spotify Token Swap Service for easy deployment to Heroku

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%