Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update callback url to not include query params and give the option of configuring the url #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cianmce
Copy link
Contributor

@cianmce cianmce commented Oct 13, 2019

Fix Invalid redirect URI caused by query params

If a redirect_url doesn't exactly match what you have entered Spotify returns:

{"error":"invalid_grant","error_description":"Invalid redirect URI"}):

This is happening because the query params are included in the redirect_url causing it to be different each time and making it impossible to enter it beforehand on their dashboard
e.g. the following is being sent as part of the POST data in the request to https://accounts.spotify.com/api/token

redirect_uri=http://example.com/auth/spotify/callback?code=BQCXvFP5i2xtD2XG1Ns4wowvnljaXceMrfwKK9f7yapWsqaRbf_ve0iu8Ep6ssnYh3DxC-CrujAATOgrw34JHv91zpkkWKxvTDfgZvYq1k5WG0Gakw4po9wQpP0Xe6XD6EJg5GeC4JnlgmOO2nEREYwieUcw92LoTXf8ADMW9N2VNsWhBuYpFXKGxCrjretzOvxDn2BJswqFvGpkGnFwzxFDFMc3sgmUzUoIJR6BG9dF3N...

instead of just

redirect_uri=http://example.com/auth/spotify/callback

This fix is based on:
https://github.com/icoretech/omniauth-spotify/blob/a6b6ccc6ee1b0c3b90ede44efc928628f4b04420/lib/omniauth-spotify.rb#L81-L88

Another solution would be to remove this file altogether and just make omniauth-spotify a dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant