Closed vwillcox closed 2 years ago
Hi!
Thanks for raising this. Is this documented anywhere? I've just added a test app on the dashboard and can add a URL without a trailing slash (granted I haven't tried this with an auth flow yet)
Hi, this is part of the authorization flow. If you do not amend the two places you have the return URL in the code, you get an error on pressing the button, and again once authorized you do not get returned to the now playing screen.
Happy to do a screen recording later of the issues.
Okay, cool! Thanks again. I'm actually away on vacation for a few days but will get this merged in this weekend.
Hey!
Sorry for the late replies on this, I've just got round to recreating this in my local environment. I had issues recreating this when testing a version on Netlify in a few different browser sessions.
From what I can tell the root-cause of this issue occurs when the Redirect URI in the Spotify dashboard have a trailing slash in, but your live URL doesn't.
For example:
This throws Invalid URI error:
This allows for a valid login:
I'm hesitant to hardcode/force a trailing slash in the codebase because we might end up with future scenarios where issues are raised for the reverse scenario.
Happy to do some further testing and see another recreation.
When I first experienced this issue, I did try the redirect URL with and without a trailing slash and each time rebuilt the app. The only solution I could find at the time was to add the slash in the code.
Closing this PR.
It looks like the Spotify dashboard will automatically add a trailing slash to the Redirect URI, whereas Netlify does not have trailing slashes.
Spotify API now needs the trailing / at the end of the authorisation URL.
Added in and now works a charm!