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

/auth/spotify route is not working #96

Closed
ljrzarate opened this issue Oct 23, 2016 · 4 comments
Closed

/auth/spotify route is not working #96

ljrzarate opened this issue Oct 23, 2016 · 4 comments

Comments

@ljrzarate
Copy link

ljrzarate commented Oct 23, 2016

Hi, Hope you are doing great
I have an issue hopefully you can help me to solve this:
I add this to my omniauth.rb initializer:

require 'rspotify/oauth'

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :spotify,
           ENV["spotify_client_id"],
           ENV["spotify_secret_key"],
           scope: 'user-read-email user-read-private playlist-modify-public user-library-read user-library-modify streaming',
end

but then when I try to use the route /auth/spotify I'm getting always a 404. Do i need to do something else somewhere?

I'm using Rails 5 and Ruby 2.3.0

Thanks!

@terryworona
Copy link

@ljrzarate did you ever get this to work? I'm running into the same issue /w Rails 5. Any insight would be appreciated!

@sdkevorkian
Copy link

sdkevorkian commented Jun 12, 2017

Hello, just wanted to add that I am having this same issue, also using rails 5 and ruby 2.3.0

Edit: I was able to get it to work just by restarting the terminal I was running the rails server from!

@mattdrewitt
Copy link

Incase anyone runs into this as I did, the version of omniauth used now requires it to be a post request, so either you need to make your link a post

<%= link_to 'Sign in with Spotify', '/auth/spotify', method: :post %>

or add

OmniAuth.config.allowed_request_methods = [:post, :get]

to your initializer

@rachel-carvalho
Copy link

Thanks for the heads up @mattdrewitt! In case anyone else needs it, after this I also needed to add omniauth-rails_csrf_protection to validate the CSRF token, which then required me to have to explicitly add omniauth to my Gemfile, so that CSRF's railtie worked.

ongaeshi added a commit to ongaeshi/spotify-api-sample that referenced this issue Aug 15, 2021
今のOmniAuthはデフォルトでpostメソッドしか受け付けない。(see guilhermesad/rspotify#96 (comment))
KrauseFx added a commit to KrauseFx/rspotify that referenced this issue Mar 22, 2022
As per guilhermesad#96, this is something needed to get omniauth up and running.
KrauseFx added a commit to KrauseFx/rspotify that referenced this issue Mar 22, 2022
As per guilhermesad#96, this is something needed to get omniauth up and running.

Alternative to guilhermesad#248
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

No branches or pull requests

6 participants