watsonbox / exportify

Export/Backup Spotify playlists using the Web API
https://exportify.app/
MIT License
3.15k stars 436 forks source link

Doesn't work locally #146

Closed axljones closed 8 months ago

axljones commented 1 year ago

When running the project locally, it doesn't work as my internal ip is passed to the spotify API:

ERROR: INVALID_CLIENT: Invalid redirect URI

URI: https://accounts.spotify.com/authorize?client_id=abcd&redirect_uri=http%3A%2F%2F192.168.0.99%3A3000%2Fexportify&scope=playlist-read-private%20playlist-read-collaborative%20user-library-read&response_type=token&show_dialog=false

fcivaner commented 1 year ago

Recently tested using docker on my local, I wasn't able to reproduce this issue with Firefox 115.3.0esr (64-bit). Just writing to provide additional information, PR for docker usage: https://github.com/watsonbox/exportify/pull/148

axljones commented 1 year ago

Recently tested using docker on my local, I wasn't able to reproduce this issue with Firefox 115.3.0esr (64-bit). Just writing to provide additional information, PR for docker usage: #148

Did you go through with the import? Did you run this on a server with a publicly reachable ip address?

fcivaner commented 1 year ago

I ran it on my local PC, using;

`docker build . -t exportify

docker run -p 3000:3000 exportify`

And then went to http://localhost:3000/ on my browser. Then I exported a couple of playlists, the data was correct

axljones commented 1 year ago

I ran it on my local PC, using;

`docker build . -t exportify

docker run -p 3000:3000 exportify`

And then went to http://localhost:3000/ on my browser. Then I exported a couple of playlists, the data was correct

The dockerfile didn't exist when I tried last time.

I've tried it again and get the same issue. Could you give me the redirect URI you get ?

Especially the value of the redirect_uri parameter.

I'm running the docker image on a local server, not my actual PC.

fcivaner commented 1 year ago

It's in the form of

https://accounts.spotify.com/en/authorize?client_id=[clientid]&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F&scope=playlist-read-private%20playlist-read-collaborative%20user-library-read&response_type=token&show_dialog=false

Maybe spotify makes an exception for localhost when handling these requests, but not for the IP address of a local server, if you are using an IP address in the local network?

axljones commented 1 year ago

It's in the form of

https://accounts.spotify.com/en/authorize?client_id=[clientid]&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F&scope=playlist-read-private%20playlist-read-collaborative%20user-library-read&response_type=token&show_dialog=false

Maybe spotify makes an exception for localhost when handling these requests, but not for the IP address of a local server, if you are using an IP address in the local network?

Yes, that is exactly what i was thinking originally. I tried using localhost but it didn't work because i didn't specify the port. It worked with your redirect_uri. I then got a new redirect url with a token so i replaced the localhost with my ip. It now loads but seems stuck in a loop. I'll keep this issue updated

http://localhost:3000/exportify#access_token=[access_token]&token_type=Bearer&expires_in=3600

image

awsms commented 1 year ago

both selfhost methods (docker & running it directly with yarn) did not work for me. the service hosted on github.io doesn't work either though :( using ungoogled-chromium 119.0.6045.105

watsonbox commented 8 months ago

Converting this to a discussion in case it evolved. I can only guess that there must be something unusual about your browser or extensions causing this issue, since that local redirect URI is valid for the app and works for others.