jonashcroft / Nowify

A Spotify 'Now Playing' screen designed for Raspberry Pi
MIT License
223 stars 415 forks source link

Correct Authorisation URL #32

Closed vwillcox closed 2 years ago

vwillcox commented 2 years ago

Spotify API now needs the trailing / at the end of the authorisation URL.

Added in and now works a charm!

jonashcroft commented 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)

Screenshot 2022-03-27 at 14 16 35

vwillcox commented 2 years ago

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.

jonashcroft commented 2 years ago

Okay, cool! Thanks again. I'm actually away on vacation for a few days but will get this merged in this weekend.

jonashcroft commented 2 years ago

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:

Screenshot 2022-04-06 at 22 12 51

This allows for a valid login:

Screenshot 2022-04-06 at 22 14 06

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.

vwillcox commented 2 years ago

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.

jonashcroft commented 2 years ago

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.

README has been updated.