Yooooomi / your_spotify

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

Using a domain instead of local IP adresses: Can't get it to work #389

Closed HexagonIsTheBestagon closed 2 months ago

HexagonIsTheBestagon commented 2 months ago

Describe the bug

After clicking on the login button, I get a completely blank page except of the usual dashboad.

Expected behavior

Normal Login, I guess.

Additional context

My compose file:

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8070:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: https://spotify.domain.cc # This MUST be included as a valid URL in the spotify dashboard
      CLIENT_ENDPOINT: https://spotify-server.domain.cc
      SPOTIFY_PUBLIC: here be dragons
      SPOTIFY_SECRET: here be dragons
      CORS: i-want-a-security-vulnerability-and-want-to-allow-all-origins

  mongo:
    container_name: mongo
    image: mongo:6
    volumes:
      - ./your_spotify_db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3002:3000"
    environment:
      API_ENDPOINT: https://spotify-server.domain.cc

Screenshot 2024-04-11 185701

Screenshot 2024-04-11 185722

Screenshot 2024-04-11 185502

hkamran80 commented 2 months ago

In your server service, I think you have the API_ENDPOINT and CLIENT_ENDPOINT variables swapped.

HexagonIsTheBestagon commented 2 months ago

Ah, that was just for a test. Doesn't work either way, sadly. Here's my cloudflare tunnel:

Screenshot 2024-04-11 191550

Excuse the bad readability.

hkamran80 commented 2 months ago

I found that I could only use it via my Cloudflare Tunnel setup because of the way the YS server returns the redirect URL. Accessing it on any other hostname (even with the appropriate CORS and other settings) failed.

HexagonIsTheBestagon commented 2 months ago

I'm not a native English speaker, may you explain it to me again? I am accessing it through a cloudflare tunnel. Is that not possible?

hkamran80 commented 2 months ago

When you go to YS, do you use your Cloudflare Tunnel setup or do you use the IP address?

HexagonIsTheBestagon commented 2 months ago

I use my cloudflare tunnel: spotify.[domain].cc

HexagonIsTheBestagon commented 2 months ago

That said, it did work correctly when just accessing it over my local ip.

hkamran80 commented 2 months ago

Huh. I have nothing then.

HexagonIsTheBestagon commented 2 months ago

I will wait for Yoomi then, thanks.

Vahelnir commented 2 months ago

Hey, it looks like your API_ENDPOINT might be wrong.

You have API_ENDPOINT: https://spotify.domain.cc in the server service, and API_ENDPOINT: https://spotify-server.domain.cc in the clientservice. If your API is on spotify-server.[domain].cc and your client is on spotify.[domain].cc, then your API_ENDPOINT should be spotify-server.[domain].cc and CLIENT_ENDPOINT should be spotify.[domain].cc.

Also, make sure the spotify public & secret tokens you wrote in the issue are invalidated.

If you want an example, I have my API on https://music.[mydomain].fr/api and the client on https://music.[mydomain].fr.

My compose.yml ```yml version: "3" services: server: image: yooooomi/your_spotify_server restart: always ports: - "8081:8080" links: - mongo depends_on: - mongo environment: API_ENDPOINT: https://music.[mydomain].fr/api CLIENT_ENDPOINT: https://music.[mydomain].fr SPOTIFY_PUBLIC: ${SPOTIFY_PUBLIC_KEY} SPOTIFY_SECRET: ${SPOTIFY_SECRET_KEY} CORS: https://music.[mydomain].fr mongo: image: mongo:6 volumes: - ./your_spotify_db:/data/db web: image: yooooomi/your_spotify_client restart: always ports: - "8082:3000" environment: API_ENDPOINT: https://music.[mydomain].fr/api ```

Hope I'm not wrong and that fixes your issue!

HexagonIsTheBestagon commented 2 months ago

Hey! That did it! Or, I think. I already had it configured like that, it then didn't work, and then I left it for the weekend. Now it works. I know that is completely useless from a developer perspective, so I'll leave it at that. Thanks you guys!

renolation commented 2 months ago

can you give me your docker compose file? specialy api endpoint. i add it but it not works