Skip to main content

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_id and client_secret and prompts you to add them if they are missing.
  • Spotify Connect Integration: Uses librespot-spotizerr-phoenix to 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

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:

  1. 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).

  2. Configure API Credentials: The script checks if your Spotizerr instance is configured with a Spotify client_id and client_secret.

    • If they are missing, it will ask if you want to configure them.
    • Select y and enter your credentials when prompted. This is a one-time setup.
  3. 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).
  4. 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.json file, and shuts down the Connect server.
  5. Register with Spotizerr: The script automatically sends the captured credentials to your Spotizerr instance, creating or updating the account.

  6. Cleanup: Finally, it will ask if you want to delete the credentials.json file. 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.

Device Identity Prompts

Before starting Spotify Connect discovery, the tool prompts you for device identity fields. Press Enter to accept the defaults for the selected device type:

  • Device name: Living Room Speaker
  • Device type: SPEAKER
  • Device ID: a random 40-character hex string (generated each run)
  • Device software version: Spotify Connect 3.2.6
  • System info string: Spotify Connect 3.2.6; Linux; Speaker

Valid device type values:

UNKNOWN, COMPUTER, TABLET, SMARTPHONE, SPEAKER, TV, AVR, STB, AUDIO_DONGLE, GAME_CONSOLE, CAST_VIDEO, CAST_AUDIO, AUTOMOBILE, SMARTWATCH, CHROMEBOOK, UNKNOWN_SPOTIFY, CAR_THING, OBSERVER, HOME_THING

Notes:

  • The login handshake still reports OS as OS_UNKNOWN (hardcoded in the librespot library).
  • Changing device_id between attempts will break decryption of the login blob.
  • Preferred locale is derived from the Spotify region prompt.
  • Defaults for device name/software/system info adjust based on the device type you choose.
  • The device type prompt is used to select a realistic profile (name/software/system info) so the advertised device looks consistent.
  • Device identity details are stored alongside the Spotify credentials in Spotizerr and reused for future librespot sessions.

Logging

The tool enables debug logging by default so you can see what it is sending. It logs:

  • The device identity values that will be advertised and sent during authentication.
  • HTTP requests to your Spotizerr server (URLs, payload keys, and response codes).
  • Librespot and Zeroconf debug output from the underlying library.

Release files for spotizerr-auth-phoenix 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotizerr-auth-phoenix 0.0.16
File Size Uploaded
spotizerr_auth_phoenix-0.0.16.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotizerr-auth-phoenix 0.0.16
File Interpreter ABI Platform
spotizerr_auth_phoenix-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / spotizerr_auth_phoenix-0.0.16.tar.gz

Download URL spotizerr_auth_phoenix-0.0.16.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc0f0dcb9fed9a93a51e0e64a415bf947697f5cad93dcce161cbc4b5a74e277
BLAKE2b-256 checksum
How to use checksums
876683c75e13f13c87ba1db7d1ea613547e8904f47d734dd16f974e3d7c964df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / spotizerr_auth_phoenix-0.0.16-py3-none-any.whl

Download URL spotizerr_auth_phoenix-0.0.16-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
611cad0ad71a773c90e4e30bc4e9b95857c9a6ab6181393a5e0be748f80e7971
BLAKE2b-256 checksum
How to use checksums
4fc85ee534c44e13c33389b93eaa70a048fc383f84f0e7bee5dcea05d158c613
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page