Announcements

Help Wizard

Step 1

NEXT STEP

Spotify OAuth works for Localhost but not Live

Spotify OAuth works for Localhost but not Live

Hi all, 

  I'm currently testing an integration of Spotify OAuth with my NextJS app. I've found that, after whitelisting the redirect URL under the developer dashboard, the localhost version (i.e. localhost:3000/api/auth/spotify) can successfully redirect the user after authenticating with spotify, but the live version will always lead to an OAuth error for some reason. I've double checked the redirect URL when the user tries to authenticate through the live app (i.e. &redirect_url=....) and double checked many times to make sure I didn't miss any backslashes or misspell the link when adding it to the list of redirect URIs. Can someone help me understand why that is? Thanks so much!

Reply
3 Replies

Hi @synphonic,

Awesome to hear that you're moving your development app into a live environment. Can you describe the error further that you are seeing? Is an error message being displayed? If the app is publicly available then feel free to post a link to it here as well.

@spotifyjosh I'm running into this same issue. The issue as I'm seeing it is when the user authenticates with their Spotify account the page redirects with the authorization code but then fails to get the access token. The authorization code is returned to the /callback url but never posts to the token API to get a valid access token. When running the same code in test the app redirects correctly and receives the access token from Spotify's server before rendering the home page correctly with the user's info. Do you have any guess as to what could be causing OAuth to redirect to a /callback url with the authorization code but not the access token? 

hi @spotifyjosh, 

I have faced the same problem as they were. when I convert my project from localhost to live the authentication is not working. People can log in but after that, they are nothing in the Home page but it's absolutely working in localhost. Please help me.

Suggested posts