Public | Automated Build

Last pushed: 7 months ago
Short Description
dockerized spotify_token_swap tool
Full Description

Spotify Token Swap Tool in Docker

To run the tool through docker use the command:

docker run \
    -e ENCRYPTION_SECRET=<...> \
    -e CLIENT_ID=<...> \
    -e CLIENT_SECRET=<...> \
    -e CALLBACK_URL=<...> \
    -p 1234:1234 \

The service will then be available at <DOCKER_HOST>:1234, which on your local
machine should be localhost:1234 and on a server with as IP
address the service should run on inside the network.

Environment Variables

The container MUST have the right credentials to work.
So do not forget to put the right credentials to env variables first!
It follows an overview of each environment variable of the container.


The ENCRYPTION_SECRET allows to pass the refresh_token to the client without
compromising on security.

REMEMBER: To decrypt the refresh_token inside your application before usage!


The encryption and decryption of the refresh_token can hinder development and
lead to hard to find bugs inside the system.

To iterate quicker it might be reasonable to start with encryption disabled.


This is the client ID from the Spotify developer website.


This is the client secret from the Spotify developer website.


The callback URL will be invoked by the Spotify API method after authentication
is finished on Spotify.

NOTE: The CALLBACK_URL value has to be present on the Spotify developer website.

How to use in iOS

Once the service is running, pass the public URI to the token swap method.
If you run it with default settings on your local machine this should be
It follows the token swap method in the iOS SDK:

  NSURL *swapServiceURL = [NSURL urlWithString:@"http://localhost:1234/swap"];

  -[SPAuth handleAuthCallbackWithTriggeredAuthURL:url

Development Guide

To run the service, enter your client ID, client secret and client callback URL
into the environment or script and run the project.

 $ ruby spotify_token_swap.rb

The logs should then show inside the console on STDOUT and STDERR.

Docker Pull Command