skuethe / MMM-Spotify

Spotify display and controller for MagicMirror
MIT License
66 stars 17 forks source link

INVALID_CLIENT: Invalid redirect URI #178

Closed jonathanzgit closed 2 years ago

jonathanzgit commented 2 years ago

Because my port 8888 is already used, i configured the 8889 as mentioned in the guide. But now i get the error INVALID_CLIENT. when i run the first_auth.js. I already changed the port number in spotify but i am unsure if i may missed something else.

It says: AUTH: express app started and listening on port 8889 [SPOTIFY - jonathan] Error in authentication: [SPOTIFY - jonathan] Error: Token file was not created ("/home/pi/MagicMirror/modules/MMM-Spotify/jonathanzmusic_token.json")

I would really appreciate some help since i am new to this topic and i dont have a lot of experience

skuethe commented 2 years ago

As you mentioned that you changed the port number in Spotify, I assume you mean you modified the App inside Spotify developer dashboard, right?

Please double check that the custom callback URL and Port you configured inside your spotify config json matches the Redirect URIs configured inside the Spotify App (not just the AUTH_PORT, but also the AUTH_DOMAIN).

If that looks good, please enable debug output and paste more information here - making sure not to paste any confidential data: set debug: true in your config.

jonathanzgit commented 2 years ago

Okay so just that i got this right: I changed inside the Spotify App the redirected Uri to http://localhost:8889/callback and in my spotify config json i changed the AUTH_PORT to 8889 and the AUTH_DOMAIN to my IP Address. I dont understand what you mean with matching the AUTH_DOMAIN with my Spotify App since i can only change my redirect uri inside the settings. Thank you for your help :)!

skuethe commented 2 years ago

The error you are seeing is because you have configured http://localhost:8889/callback in your Spotify App URI but have set AUTH_DOMAIN to something OTHER than http://localhost (probably the local networks IP-Address of your MM. These need to match.

Example: If your spotify.config.json looks like this:

[
  {
      ...
      "AUTH_DOMAIN": "http://1.2.3.4",
      "AUTH_PORT": "8889"
  }
]

Then your Spotify App URI needs to look like this: http://1.2.3.4:8889/callback

skuethe commented 2 years ago

Did this resolve your issue @jonathanzgit ?

jonathanzgit commented 2 years ago

Yes thank you so much :)!