A Spotizerr authentication utility for configuring Spotify credentials
Project description
Spotizerr Authentication Utility
A command-line tool to help you authenticate and register a Spotify account with your Spotizerr instance. This utility simplifies the process by programmatically capturing Spotify session credentials and posting them to your Spotizerr backend.
Features
- Interactive Setup: Guides you through the process of connecting to your Spotizerr instance.
- API Credential Check: Automatically checks if your Spotizerr instance has the required Spotify API
client_idandclient_secretand prompts you to add them if they are missing. - Spotify Connect Integration: Uses
librespot-spotizerr-phoenixto create a temporary Spotify Connect device, allowing you to capture credentials securely by simply playing a song. - Colored Output: Uses color-coded terminal output to highlight important information and make the process easier to follow.
- Clean Exit: Gracefully handles interruptions and ensures a clean shutdown.
Prerequisites
- Docker
- A running instance of Spotizerr.
- Spotify
client_idandclient_secret. You can get these by creating an application on the Spotify Developer Dashboard.
Usage
Run the script from your terminal:
docker run --network=host --rm -it spotizerrphoenix/spotizerr-auth
If docker doesn't work (it probably won't unless your on linux) you can still run it in bare metal.
Run the installer
Linux / macOS
python3 -m venv .venv && source .venv/bin/activate && pip install spotizerr-auth-phoenix
Windows (PowerShell)
python -m venv .venv; .venv\Scripts\Activate.ps1; pip install spotizerr-auth-phoenix
Windows (cmd.exe)
python -m venv .venv && .venv\Scripts\activate && pip install spotizerr-auth-phoenix
And then run
spotizerr-auth-phoenix
You will have to activate the virtual environment every time you want to use the tool.
The script will guide you through the following steps:
-
Enter Spotizerr URL: You'll be prompted for the base URL of your Spotizerr instance. You can press Enter to use the default (
http://localhost:7171). -
Configure API Credentials: The script checks if your Spotizerr instance is configured with a Spotify
client_idandclient_secret.- If they are missing, it will ask if you want to configure them.
- Select
yand enter your credentials when prompted. This is a one-time setup.
-
Enter Account Details:
- Provide a name for the account to identify it in Spotizerr.
- Enter your two-letter Spotify region code (e.g.,
US,DE,MX).
-
Authenticate via Spotify Connect:
- The utility will ask you to name the temporary Spotify Connect device (default: randomized like
Device - 8KQ2). - It will then start that device on your network.
- Open Spotify on any device (phone, desktop), start playing a track, and use the "Connect to a device" feature to transfer playback to the new device.
- Once you transfer playback, the script captures the session, creates a
credentials.jsonfile, and shuts down the Connect server.
- The utility will ask you to name the temporary Spotify Connect device (default: randomized like
-
Register with Spotizerr: The script automatically sends the captured credentials to your Spotizerr instance, creating or updating the account.
-
Cleanup: Finally, it will ask if you want to delete the
credentials.jsonfile. It's recommended to do so for security.
After these steps, your Spotify account will be registered in Spotizerr and ready to use.
How It Works
The script uses librespot-spotizerr's Zeroconf implementation to advertise a Spotify Connect device on the local network. When you transfer playback to this device, librespot-spotizerr handles the authentication with Spotify's servers and stores the session details (including the necessary refresh token) in a local credentials.json file. The advertised device name is the one you provide during the prompt.
Once this file is created, the script reads it and makes a POST request to the Spotizerr API endpoint /api/credentials/spotify/{accountName}. The request body is a JSON object containing the user's region and the contents of credentials.json, which Spotizerr then stores for future use.
The initial check for client_id and client_secret ensures that Spotizerr has the necessary global API credentials to perform metadata lookups and other API-dependent tasks.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spotizerr_auth_phoenix-0.0.14.tar.gz.
File metadata
- Download URL: spotizerr_auth_phoenix-0.0.14.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af7959402d307fee5edcfac0b4a07081e5281ae937beac941e56ce8298c29e92
|
|
| MD5 |
bfe648f783a5a4c6409fd16e00eaea03
|
|
| BLAKE2b-256 |
1fb12768ebb8569d96d3574405dafd6a9d9810f530452b186d1700d3d3596a61
|
File details
Details for the file spotizerr_auth_phoenix-0.0.14-py3-none-any.whl.
File metadata
- Download URL: spotizerr_auth_phoenix-0.0.14-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdc02c8c70c5f1c734f6bd7ee33e5645051a36ef3548100b188b785687eb9668
|
|
| MD5 |
4c1630459e3c0b95da17b5a501a68b1b
|
|
| BLAKE2b-256 |
e1cd5bc2588fe0c95eba24f35e49c4494e9b6dcb1e64d53ab6a1a7ee2cbafeb2
|