[GH-ISSUE #169] Implementation Issues (redirect loop or invalid return URI) #108

Closed
opened 2026-02-27 19:26:07 +03:00 by kerem · 4 comments
Owner

Originally created by @thejames76 on GitHub (Oct 30, 2019).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/169

Hello,

I'm trying to implement this wrapper and have had minimal success. I admit I'm a hack-n-slash PHP guy... I know just enough to get by and also get in trouble.

I tried using this example https://gist.github.com/jwilsson/07f30721b5a3378c78bf4c86cdc92b98 as my other attempts failed.

When using the code "as-is" (and it was admittedly not necessarily going to work, so I place no blame on anyone other than myself), I get the error "INVALID_CLIENT: Invalid redirect URI"

When I replace the return URI to use the one from the spotify app, I then get an error from spotify saying there were too many redirects. Not really sure where to go from here, so I'm hoping someone can gently smack me upside the head a bit.

I've attached my index.php and callback.php files (both altered to remove client/site info).

index.txt

callback.txt

** edits: trying to format my source code for the issue

Originally created by @thejames76 on GitHub (Oct 30, 2019). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/169 Hello, I'm trying to implement this wrapper and have had minimal success. I admit I'm a hack-n-slash PHP guy... I know just enough to get by and also get in trouble. I tried using this example https://gist.github.com/jwilsson/07f30721b5a3378c78bf4c86cdc92b98 as my other attempts failed. When using the code "as-is" (and it was admittedly not necessarily going to work, so I place no blame on anyone other than myself), I get the error "INVALID_CLIENT: Invalid redirect URI" When I replace the return URI to use the one from the spotify app, I then get an error from spotify saying there were too many redirects. Not really sure where to go from here, so I'm hoping someone can gently smack me upside the head a bit. I've attached my index.php and callback.php files (both altered to remove client/site info). [index.txt](https://github.com/jwilsson/spotify-web-api-php/files/3786705/index.txt) [callback.txt](https://github.com/jwilsson/spotify-web-api-php/files/3786704/callback.txt) ** edits: trying to format my source code for the issue
kerem 2026-02-27 19:26:07 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@jwilsson commented on GitHub (Oct 30, 2019):

Hey!
I can't see anything wrong with the code and it's working when I'm running it. A guess is that the session isn't set correctly.

I'd try getting it to work with a single, bare minimum file. Like this, https://gist.github.com/jwilsson/5c91b34c53b1f34f6f7e9995e01f47e8

<!-- gh-comment-id:548045758 --> @jwilsson commented on GitHub (Oct 30, 2019): Hey! I can't see anything wrong with the code and it's working when I'm running it. A guess is that the session isn't set correctly. I'd try getting it to work with a single, bare minimum file. Like this, https://gist.github.com/jwilsson/5c91b34c53b1f34f6f7e9995e01f47e8
Author
Owner

@thejames76 commented on GitHub (Oct 30, 2019):

Definitely progress here... I'm guessing I'm running into a permissions issue when running $api->getMyCurrentTrack();

I've updated the scopes to include:
user-library-modify
user-read-currently-playing
user-read-playback-state

I've revoked access to the app and re-authorized with the new scopes but get the same error.

perm-error

<!-- gh-comment-id:548061019 --> @thejames76 commented on GitHub (Oct 30, 2019): Definitely progress here... I'm guessing I'm running into a permissions issue when running $api->getMyCurrentTrack(); I've updated the scopes to include: user-library-modify user-read-currently-playing user-read-playback-state I've revoked access to the app and re-authorized with the new scopes but get the same error. ![perm-error](https://user-images.githubusercontent.com/11576197/67888965-67c6ff80-fb24-11e9-8419-24ade0de0dfc.png)
Author
Owner

@jwilsson commented on GitHub (Oct 30, 2019):

Glad we're making progress!

That sounds like an issue in Spotify's end though, I'd file an issue over there.

<!-- gh-comment-id:548071478 --> @jwilsson commented on GitHub (Oct 30, 2019): Glad we're making progress! That sounds like an issue in Spotify's end though, I'd file an issue [over there](https://github.com/spotify/web-api).
Author
Owner

@thejames76 commented on GitHub (Oct 30, 2019):

Yep, I can pull back my playlists, just need to figure that out adding / subtracting tracks, etc... (which shouldn't be a problem).

I really appreciate your help with my connection / setup issues.

Thanks!

<!-- gh-comment-id:548073585 --> @thejames76 commented on GitHub (Oct 30, 2019): Yep, I can pull back my playlists, just need to figure that out adding / subtracting tracks, etc... (which shouldn't be a problem). I really appreciate your help with my connection / setup issues. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#108
No description provided.