-
-
Notifications
You must be signed in to change notification settings - Fork 290
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 documentation to include examples of initialisation #218
Comments
@dylan-hoefsloot did you get anywhere with this? I'm trying to build a CLI tool to rebuild a playlist on demand (for my own user account). Hitting this error: irb(main):012:0> spotify_user.create_playlist!('meep123')
Traceback (most recent call last):
8: from /Users/robbyrussell/.rbenv/versions/2.7.1/bin/irb:23:in `<main>'
7: from /Users/robbyrussell/.rbenv/versions/2.7.1/bin/irb:23:in `load'
6: from /Users/robbyrussell/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
5: from (irb):12
4: from /Users/robbyrussell/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspotify-2.9.1/lib/rspotify/user.rb:129:in `create_playlist!'
3: from /Users/robbyrussell/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspotify-2.9.1/lib/rspotify/user.rb:77:in `block (2 levels) in <class:User>'
2: from /Users/robbyrussell/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspotify-2.9.1/lib/rspotify/user.rb:63:in `oauth_send'
1: from /Users/robbyrussell/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspotify-2.9.1/lib/rspotify/user.rb:55:in `oauth_header'
NameError (uninitialized class variable @@users_credentials in RSpotify::User) |
@robbyrussell i can't believe i ran into the creator of oh-my-zsh here, i never look you up but i instantly recognize your name from the default theme. I have used oh-my-zsh since I started coding and have always been a fan for the issue you are having, I don't think you can create CLI app that modifies user data (playlist). Anything the modifies user data need to be redirected and confirmed by user. I think they mentioned that in the doc in FAQ at the bottom https://developer.spotify.com/documentation/general/guides/authorization-guide/ but you might have already found this 😄 that said i'm having issues with logging in with oauth with the gem as well |
The only information I could find in the documentation, if you want to create a new user without adding RSpotify as middleware in rails was this:
However, it is a bit unclear.
Which response? It is not specified. I thought it would be safe to assume it takes the response from Spotify containing
However this didn't work, so I looked at the source for
User
and it is looking for acredentials
field, which Spotify does not return in any of the flows.I tried passing the above
auth_params
to the new method like soUser.new('credentials' => auth_params)
, while this stopped me getting error about credentials not existing, all the internal RSpotify requests were returning400 Bad Request
For these reasons I think it is worth adding an example of what
RSpotify::User.new
expects.I think it is also worth adding something about having to execute
RSpotify.authenticate('CLIENT_ID', 'CLIENT_SECRET')
before making non user specific requests, as I only found this through looking at the Rails OAuth example, and you need it regardless of OAuth.I still haven't figured this out, but if someone can give me an example I would be more than happy to update the documentation.
The text was updated successfully, but these errors were encountered: