Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
3.09k stars 124 forks source link

Issues with setup #234

Closed Brulijam closed 1 year ago

Brulijam commented 1 year ago

Hi, I am using this docker compose setup

version: "3"

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: https://spotify.domain.com/api/
      CLIENT_ENDPOINT: https://spotify.domain.com/
      SPOTIFY_PUBLIC: abc123
      SPOTIFY_SECRET: abc123
  mongo:
    container_name: mongo
    image: mongo:6
    volumes:
      - /var/docker/your_spotify/db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3000:3000"
    environment:
      API_ENDPOINT: https://spotify.domain.com/api/

and nginx proxy manager where spotify.domain.com proxies to 172.18.0.1:3000 and spotify.domain.com/api to 172.18.0.1:8080.

The redirect uri in the spotify app dashboard is set to https://spotify.domain.com/api/oauth/spotify/callback.

When opening spotify.domain.com I get the Error The web application can't communicate with the server and the login button redirects to http://localhost:8884/oauth/spotify.

Not sure what I am missing.

Yooooomi commented 1 year ago

Hello. Your setup seems fine to me. Maybe you should remove the trailing slashes at the end of your urls. You should also double check your proxy settings.

Cthalin commented 1 year ago

+1 Same issue here. I got no trailing slashes and am using cloudflare tunnel for forwarding the web and api ports. Edit: It seems like the API_ENDPOINT is not set correctly in this case. It's always just localhost:8080 per default. :/ The server gives the correct log for setting the endpoint, but nevertheless in browser the variable is not set to this endpoint. echo "Setting API Endpoint to '$API_ENDPOINT'" sed -i "s;__API_ENDPOINT__;$API_ENDPOINT;g" "$VAR_PATH/variables.js" I've got absolutely no clue about web development but I'll look further... xD Edit2: Inside the container the variables.js is also set correctly. Why is it not translated into the browser then....

FMeinicke commented 1 year ago

I just ran into the same issue. My browser cached the wrong API endpoint from a previous time (I went through a couple edit the compose file and restart the containers cycles before I had everything set up correctly). Using a different browser allowed me to log in with Spotify as expected. I'd suggest trying a different browser or a private window or clearing the browser cache explicitly.

Brulijam commented 1 year ago

Clearing browser cache, removing trailing "/" and using a seperate subdomain as API-Endpoint (spotify-api.domain.com instead of spotify.domain.com/api) fixed the issue.