Announcements
The Spotify Stars Program: Celebrating Values Week!

Help Wizard

Step 1

NEXT STEP

Issue with Redirect URL when using react app + node on Heroku

Issue with Redirect URL when using react app + node on Heroku

I'm developing an app using the Spotify API with a React from end running on localhost:3000 and a node back end running on localhost:8888.  The back end takes care of the authentication, where my redirect url is localhost:8888/callback.  This is fine in development because I will always know what port the backend is on, but when I deploy to Heroku, the back end port is chosen dynamically, so I can't enter a specific redirect url on my spotify dev page.  How could I make it that this callback url is known before hand?  My first thought was to make the the callback to my front end (the actual herokuapp link) and then redirect to the dynamically chosen port.  Is there a better way?

Reply
2 Replies

Did you manage to resolve this issue? I am currently in the process of deploying my app on Heroku too and having similar issues.

I have only used heroku a few years ago, but doesn't heroku put a reverse proxy(HTTP routing) in front of your node process? So you can access it either on HTTP 80 or HTTPS 443 and don't have to care about the app port?
https://devcenter.heroku.com/articles/http-routing

Suggested posts