bih/spotify-ruby

URL returned by @accounts.authorize_url was wrong, but really it was a gem issue.

dav opened this issue · 1 comments

dav commented

As reported in a Spotify Developer community post, the URL string being returned was incorrect.

Using the gem, I am obtaining an URL like this:

url = @accounts.authorize_url(scope: scopes)

It appeared to be a correct oauth authorization URL, but loading it in the browser always results in a Spotify "Oops! Something went wrong" error page when loaded.

This is an example of the URL:

https://accounts.spotify.com/oauth/authorize?client_id=someID&redirect_uri=someEncodedURL&response_type=code&scope=user-read-private

The problem turned out to be that the "/oauth" part of the URL was incorrect. If I removed that portion, the page loaded fine with the permission flow.

url.gsub!(/\/oauth/, '')

On further investigation, I see that this URL has long been fixed in the code here, the problem was that bundler was not finding the most recent version of the gem. It installed v 0.2.4 and it was surprisingly difficult to get it to load v 0.2.5.

I ended up needing to put this in my Gemfile:

gem 'spotify-ruby', git: 'https://github.com/bih/spotify-ruby', ref: '9cafd653e2ca7b077f8261b9c78da96ae9f1acc3'

I'm not sure what is going on here, but since I traveled a pretty normal route to get into this mess, I figure it would be good to raise an issue because others are likely to have the same problem.

This was fixed in 76a0fad but 0.2.5 hasn't been released and pushed to rubygems yet.

@bih are you able to tag master and publish 0.2.5? many thanks.