Announcements

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

Reply
Highlighted

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

Newbie

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?

SUGGESTED POSTS