Closed jomsc closed 2 years ago
Funnily enough, I just came here to report a very similar issue. I'll describe it here first, and create a new issue if it's not caused by the same bug.
I set everything up and I can log in myself, however when I'm not logged in I get: Could not retrieve all the registered accounts. Clicking log in with Spotify works, the app is fully functional and shows all the stats. However, friends are unable to register, they just get sent back to /login with the same Could not retrieve all the registered accounts. I've restarted the service, however that did not help.
In the debugger window is a 401 unauthorized response from the backend for /backend/accounts (I set the base path to /backend, everything else works). Looking into the logs of the server docker, the 401 response shows up there as well.
I tried to ease the CORS setting and set it to all, however that didn't help either.
I'm using Swag with NGINX as a reverse proxy between Cloudflare and my server.
Here is my compose file: (notice there aren't any port mappings, since I'm proxying directly to the container from the swag container, inside the docker network)
services:
backend:
container_name: yourspotify-backend
image: yooooomi/your_spotify_server
networks:
swag:
restart: always
links:
- mongo
depends_on:
- mongo
environment:
- API_ENDPOINT=https://my.domain/backend # This MUST be included as a valid URL in the spotify dashboard (see below)
- CLIENT_ENDPOINT=https://my.domain
- SPOTIFY_PUBLIC=7f9b3469fa874fc78488a630c750fb6b
- SPOTIFY_SECRET=d817c35124ac45c4964120dc57136678
- CORS=all # https://my.domain # commented out the domain here, but that didn't help
mongo:
container_name: yourspotify-mongo
image: mongo:4.4.8
networks:
swag:
volumes:
- /mnt/user/appdata/yourspotify/mongo:/data/db
web:
container_name: yourspotify-frontend
image: yooooomi/your_spotify_client
networks:
swag:
restart: always
environment:
- API_ENDPOINT=https://my.domain/backend
networks:
swag:
external: true
This is the nginx configuration:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name spotify.*;
include /config/nginx/ssl.conf;
location /backend {
return 301 $scheme://$host/backend/;
}
location /backend/ {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app yourspotify-backend;
set $upstream_port 8080;
set $upstream_proto http;
rewrite /backend(.*) $1 break;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location / {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app yourspotify-frontend;
set $upstream_port 3000;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
As I said, it all works after logging in with my own account. It doesn't work for anybody else though.
Funnily enough, I just came here to report a very similar issue. I'll describe it here first, and create a new issue if it's not caused by the same bug.
Be careful, you showed your secret key.
Hello @phesox ! The problem is quite simple, the API_ENDPOINT variable only needs the endpoint, and not the suffix you set. Setting API_ENDPOINT=192.168.1.200:8085 in both client and server should work.
Hello @phesox ! The problem is quite simple, the API_ENDPOINT variable only needs the endpoint, and not the suffix you set. Setting API_ENDPOINT=192.168.1.200:8085 in both client and server should work.
Oh, it was as simple as that. It works now, and thanks a lot, I should have read the other answers more closely.
Thanks a lot for taking your time to answer !
Thanks for the reminder, I changed the Spotify application.
Hello ! I am trying to setup this app inside my docker-compose file, but when I go to the web interface, it says Could not retrieve all the registered accounts and when I click login, I am redirected to
http://192.168.1.200:8085/oauth/spotify/callback/oauth/spotify
and the page yields the following error :Cannot GET oauth/spotify/callback/oauth/spotify
Here is my compose file :
Here is a screenshot of my redirected URLs in my Spotify app :
Could someone help me ?