Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Having problems with Redirect URL in production

Solved!

Having problems with Redirect URL in production

I previously had an issue around redirect_uri that was quickly clarified and solved (thank you! 😁). My app runs perfectly locally, but now that I've deployed it on Heroku, I'm running into a related and confusing issue. To confirm, the 'redirect_uri' setting matches exactly in both the code and in the app settings in Spotify. I've experimented with different valid URIs and had the same result.

 

Authentication is working locally, however, when deployed to a production server, the authentication breaks at the point after logging in to Spotify and the user is authorized. The user should then be returned to my app to enter a playlist URL, but instead is being sent to redirect_uri/?+code=+state=, which results in a browser error:"Unable to connect / Firefox can’t establish a connection to the server at 127.0.0.1:5000."

 

Instead of getting an access_token and refresh_token in the redirect_uri, I instead get ?code. Have you seen this before? e.g. http://redirect_uri.com/?code=xxxx&state=xxxx 

 

For example:

http://127.0.0.1:5000/callback?code=AQDuFlTFC60VS0PO3ol90qMFJb0RgcX9y9Bjd7Zs7oiZwnnfkcTMd0oGxHEMFrQOVVaLPb8xiV23ca5IaKPu5aS-1hCuPfkQC-EII3J9sWGLaFfay1Jv8UzeSJEcln0F6wyt_h-azqMvLRUJ_l3FvFKWIhPtJjvdYLX-HueqIhRHAo5qur2sNxA2ObYilskrG2jpzpvi14Aw&state=OJ3M2R57892U2H2P

Reply

Accepted Solutions
Marked as solution

Hi @joanofsnark, Nice to hear you've made progress with your app! When authentication begins, your app tells Spotify which redirection URI it would like to use (through the redirect_uri parameter). Is it possible that your app is passing a development redirect_uri to Spotify when you intended to pass a redirect_uri that points to your running Heroku app?

View solution in original post

3 Replies
Marked as solution

Hi @joanofsnark, Nice to hear you've made progress with your app! When authentication begins, your app tells Spotify which redirection URI it would like to use (through the redirect_uri parameter). Is it possible that your app is passing a development redirect_uri to Spotify when you intended to pass a redirect_uri that points to your running Heroku app?

Hi, Josh — thank you so much for your swift reply! I really appreciate it. 🙂

I was just about to come back and update because yes, the issue was my code and not Spotify being weird! You know how it is when you look at code a long time, you start seeing the forest and not the trees…

The code in the button was set to “localhost/login” instead of the proper “/login” route.

Thank you again!! 😄


Glad you got things sorted out 😀

Suggested posts