Setting the Spotify API Client and Secret via UI stores in wrong key #10

Closed
opened 2025-12-03 13:12:32 +00:00 by bortsampson89 · 2 comments

Describe the bug
I originally used my main account for the Spotify Api credentials and I wanted to switch to an alt. When updating the credentials via the UI, it adds snake_case keys to the config in addition to the existing camelCase keys.

To Reproduce
Precise steps to reproduce the behavior (start from how you built your container):

  1. docker compose up (clicked from UI in unraid docker compose plugin)
  2. Go to config page, server settings
  3. Update client id/secret
  4. See that config/main.json has both client_id & clientID as well as client_secret & clientSecret

Expected behavior
Updating through UI should update the credentials successfully

Desktop):

  • OS: Unraid
  • Browser: Chrome

docker-compose.yaml

services:
  spotizerr:
    image: spotizerrphoenix/spotizerr
    container_name: spotizerr-app
    restart: unless-stopped

    ports:
      - "7171:7171"

    volumes:
      - /mnt/user/appdata/spotizerr:/app/data
      - /mnt/user/data/media/music/spotizerr-downloads/:/app/downloads
      - /mnt/user/appdata/spotizerr/logs:/app/logs
      - /mnt/user/appdata/spotizerr/.cache:/app/.cache

    env_file:
      - .env
    environment:
      - REDIS_URL=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}
      - REDIS_BACKEND=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}
      - EXPLICIT_FILTER=${EXPLICIT_FILTER}

    depends_on:
      - redis

  redis:
    image: redis:alpine
    container_name: spotizerr-redis
    restart: unless-stopped
    env_file:
      - .env
    command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
    volumes:
      - redis-data:/data

  tailscale:
    image: tailscale/tailscale:latest
    container_name: spotizerr-tailscale
    depends_on:
      - spotizerr
    network_mode: "service:spotizerr"
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - /mnt/user/appdata/spotizerr/tailscale/state:/var/lib/tailscale
      - /mnt/user/appdata/spotizerr/tailscale:/config
      - /dev/net/tun:/dev/net/tun
    environment:
      - TS_AUTHKEY=${TS_AUTHKEY}
      - TS_STATE_DIR=/var/lib/tailscale
      - TS_HOSTNAME=spotizerr
      - TS_SERVE_CONFIG=/config/spotizerr-serve.json
    restart: always

volumes:
  redis-data:
    driver: local

.env

REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=[redacted]

TS_AUTHKEY=[redacted]

EXPLICIT_FILTER=false

Config

{
  "service": "spotify",
  "version": "3.3.1",
  "spotify": "Alt",
  "deezer": "Main",
  "fallback": true,
  "spotifyQuality": "VERY_HIGH",
  "deezerQuality": "FLAC",
  "realTime": true,
  "customDirFormat": "%ar_album%/%album%",
  "customTrackFormat": "%tracknum% %music%",
  "tracknumPadding": true,
  "saveCover": true,
  "maxConcurrentDownloads": 1,
  "utilityConcurrency": 1,
  "librespotConcurrency": 2,
  "maxRetries": 3,
  "retryDelaySeconds": 5,
  "retryDelayIncrease": 5,
  "convertTo": "",
  "bitrate": null,
  "artistSeparator": "; ",
  "recursiveQuality": false,
  "spotifyMetadata": true,
  "separateTracksByUser": false,
  "watch": {
    "enabled": true,
    "watchPollIntervalSeconds": 3600,
    "maxTracksPerRun": 50,
    "watchedArtistAlbumGroup": [
      "album",
      "single"
    ],
    "delayBetweenPlaylistsSeconds": 2,
    "delayBetweenArtistsSeconds": 5,
    "useSnapshotIdChecking": true,
    "maxItemsPerRun": 50
  },
  "realTimeMultiplier": 1,
  "padNumberWidth": 2,
  "sseUpdateIntervalSeconds": 1,
  "explicitFilter": false,
  "clientID": "redacted",
  "clientSecret": "redacted"
  "client_id": "redacted",
  "client_secret": "redacted"
}

Version
v4.0.13

**Describe the bug** I originally used my main account for the Spotify Api credentials and I wanted to switch to an alt. When updating the credentials via the UI, it adds snake_case keys to the config in addition to the existing camelCase keys. **To Reproduce** Precise steps to reproduce the behavior (start from how you built your container): 1. `docker compose up` (clicked from UI in unraid docker compose plugin) 2. Go to config page, server settings 3. Update client id/secret 4. See that config/main.json has both `client_id` & `clientID` as well as `client_secret` & `clientSecret` **Expected behavior** Updating through UI should update the credentials successfully **Desktop):** - OS: Unraid - Browser: Chrome **docker-compose.yaml** ``` services: spotizerr: image: spotizerrphoenix/spotizerr container_name: spotizerr-app restart: unless-stopped ports: - "7171:7171" volumes: - /mnt/user/appdata/spotizerr:/app/data - /mnt/user/data/media/music/spotizerr-downloads/:/app/downloads - /mnt/user/appdata/spotizerr/logs:/app/logs - /mnt/user/appdata/spotizerr/.cache:/app/.cache env_file: - .env environment: - REDIS_URL=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB} - REDIS_BACKEND=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB} - EXPLICIT_FILTER=${EXPLICIT_FILTER} depends_on: - redis redis: image: redis:alpine container_name: spotizerr-redis restart: unless-stopped env_file: - .env command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes volumes: - redis-data:/data tailscale: image: tailscale/tailscale:latest container_name: spotizerr-tailscale depends_on: - spotizerr network_mode: "service:spotizerr" cap_add: - NET_ADMIN - NET_RAW volumes: - /mnt/user/appdata/spotizerr/tailscale/state:/var/lib/tailscale - /mnt/user/appdata/spotizerr/tailscale:/config - /dev/net/tun:/dev/net/tun environment: - TS_AUTHKEY=${TS_AUTHKEY} - TS_STATE_DIR=/var/lib/tailscale - TS_HOSTNAME=spotizerr - TS_SERVE_CONFIG=/config/spotizerr-serve.json restart: always volumes: redis-data: driver: local ``` **.env** ``` REDIS_HOST=redis REDIS_PORT=6379 REDIS_DB=0 REDIS_PASSWORD=[redacted] TS_AUTHKEY=[redacted] EXPLICIT_FILTER=false ``` **Config** ``` { "service": "spotify", "version": "3.3.1", "spotify": "Alt", "deezer": "Main", "fallback": true, "spotifyQuality": "VERY_HIGH", "deezerQuality": "FLAC", "realTime": true, "customDirFormat": "%ar_album%/%album%", "customTrackFormat": "%tracknum% %music%", "tracknumPadding": true, "saveCover": true, "maxConcurrentDownloads": 1, "utilityConcurrency": 1, "librespotConcurrency": 2, "maxRetries": 3, "retryDelaySeconds": 5, "retryDelayIncrease": 5, "convertTo": "", "bitrate": null, "artistSeparator": "; ", "recursiveQuality": false, "spotifyMetadata": true, "separateTracksByUser": false, "watch": { "enabled": true, "watchPollIntervalSeconds": 3600, "maxTracksPerRun": 50, "watchedArtistAlbumGroup": [ "album", "single" ], "delayBetweenPlaylistsSeconds": 2, "delayBetweenArtistsSeconds": 5, "useSnapshotIdChecking": true, "maxItemsPerRun": 50 }, "realTimeMultiplier": 1, "padNumberWidth": 2, "sseUpdateIntervalSeconds": 1, "explicitFilter": false, "clientID": "redacted", "clientSecret": "redacted" "client_id": "redacted", "client_secret": "redacted" } ``` **Version** v4.0.13

interesting thanks for pointing this out. haven't made any changes related to this so looks like a regression from the previous repo

after some investigation the config/server page is using a generalized/generic api client which saves the config but takes the whole payload and adds it to the main.json, even though this should be separated specifically for the api credentials.

  • the snake_case is correct but it should be saved to and accessed from data/creds/search.json instead of data/config/main.json
  • i believe the 3.3.0 migration file updates anything in the main.json to camelCase which is reason for seeing both in main.json even though the api search creds should not exist in main.json
  • for a workaround while this is being fixed, update data/creds/search.json with the correct client_id and client_secret
  • then in data/config/main.json: remove both camelCased & snake_cased versions of client id and secret
interesting thanks for pointing this out. haven't made any changes related to this so looks like a regression from the previous repo after some investigation the config/server page is using a generalized/generic api client which saves the config but takes the whole payload and adds it to the main.json, even though this should be separated specifically for the api credentials. - the snake_case is correct but it should be saved to and accessed from `data/creds/search.json` instead of `data/config/main.json` - i believe the 3.3.0 migration file updates anything in the `main.json` to camelCase which is reason for seeing both in main.json even though the api search creds should not exist in main.json - for a workaround while this is being fixed, update `data/creds/search.json` with the correct client_id and client_secret - then in `data/config/main.json`: remove both camelCased & snake_cased versions of client id and secret

@bortsampson89 fixed in version 4.0.14: https://lavaforge.org/spotizerrphoenix/spotizerr-phoenix/releases/tag/v4.0.14

fix: Setting the Spotify API Client and Secret via UI stores in wrong key #10

  • prior to this fix, api creds was being saved to data/config/main.json
  • this change fixes the above by correctly mapping api creds to data/creds/search.json

after updating your image to latest (spotizerrphoenix/spotizerr)

  • remove both camelCased & snake_cased versions of client id and secret in data/config/main.json if they exist there
  • you may need to clear cache and reload page to update stale changes
@bortsampson89 fixed in version `4.0.14`: https://lavaforge.org/spotizerrphoenix/spotizerr-phoenix/releases/tag/v4.0.14 fix: Setting the Spotify API Client and Secret via UI stores in wrong key https://lavaforge.org/spotizerrphoenix/spotizerr-phoenix/issues/10 - prior to this fix, api creds was being saved to `data/config/main.json` - this change fixes the above by correctly mapping api creds to `data/creds/search.json` after updating your image to latest (`spotizerrphoenix/spotizerr`) - remove both camelCased & snake_cased versions of client id and secret in `data/config/main.json` if they exist there - you may need to clear cache and reload page to update stale changes
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
spotizerrphoenix/spotizerr-phoenix#10
No description provided.