-
Notifications
You must be signed in to change notification settings - Fork 25
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
Invalid redirect URI #7
Comments
ensure you have setup your redirect uri correctly in your spotify app preferences: also you might want to conceal the client_id and secret in the ticket. |
Yes this callback is added: For http/https i don't use https on the project. |
On the same app, omniauth-deezer is working. |
Mathieus-MacBook-Pro-2: empty ! |
are you using devise or pure omniauth? |
pure omniauth |
can you try deleting the first and the third redirect uris and try again? |
Mathieus-MacBook-Pro-2: |
the same: OAuth2::Error Extracted source (around line #117):
Rails.root: /Users/me/workspace/business-projects/backup-my-playlists Application Trace | Framework Trace | Full Trace Parameters: {"code"=>"AQA4nDPJLTi3tomX4SdLdUUo15l-Mb-67MCpWC05ZpN_A1N3NvGSFNH7-TsnwiTlC13AXJZ3sNmlxfKNS4bUKu6gTx2scIEhp7FAQPTitjNgCUn7i0C1VHLNrMqROkds3NCK8i6UJt3jis1lbpHDFhbEDtjpL3_y2PH7Y2Ss452MdRykXO9paMXIPCFPnhZ1TSENZPhBEZezHwu7nXvKYWdWP7YGFZ7fK7rM", |
what does the rails (or stdout -- something like omniauth/devise like to use) log prints when you get launched on spotify and back? |
Started GET "/auth/spotify" for 127.0.0.1 at 2015-11-03 12:05:05 +0000 Started GET "/auth/spotify" for 127.0.0.1 at 2015-11-03 12:05:06 +0000 Started GET "/auth/spotify/callback?code=AQDqQoDNfb2tprc_N5J5xH7qg6nScD00YX0hr3sbo4SVF0tKOUp73I__VC4fL_qAWm66wdfvB67xO-wGQuRRScqM21Wh6B3yhSz-pTDnIfo8Ti0lPByUDcfW-VzFAqfghDBIEIS5RHrF934p2HGL0-XsDD6ZIcQLjmk2P0LWujCHXxQEEPAl1ol3i3Gr3m2cb8Z9yayJiwPmBJVV7VVmvoyTweT-XZ-quZdg&state=ff9512b77cf6cccf8c548f3d036e62294c4112480a567c7a" for 127.0.0.1 at 2015-11-03 12:05:06 +0000 https://accounts.spotify.com/api/token:raise_errors: true OAuth2::Error (invalid_grant: Invalid redirect URI Rendered /Users/me/.rvm/gems/ruby-2.2.1@playlistconverterv2/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (7.1ms) |
maybe there is Started GET "/auth/spotify" twice ? |
maybe, I just redid the authentication process in dev and I'm afraid it works well for me.
|
"the app configuration or the path that you are sending to spotify" can you explain a little bit more please ? |
I had to do some workarounds in the past on some rails apps to make them work with OmniAuth, for example currently I have this (but not in the project that's working without those changes): the key was changing # See also:
# https://gist.github.com/1236839
# OmniAuth.config.full_host = "https://#{Settings.app.host}"
unless Rails.env.test?
OmniAuth.config.full_host = ->(env) do
if Rails.env.staging? || Rails.env.production?
"https://#{Settings.app.host}"
else
if env['omniauth.strategy'].is_a?(OmniAuth::Strategies::Dropbox)
# Dropbox works only in https atm.
"https://#{Settings.app.host}"
else
"http://#{Settings.app.host}:#{Settings.app.port}"
end
end
end
end
OmniAuth.config.logger = Rails.logger
OmniAuth.config.path_prefix = '/account/auth'
# By default, in development mode, OmniAuth calls this endpoint when /callbacks fails:
# "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}#{origin_query_param}#{strategy_name_query_param}"
# which in turn calls our /failure endpoint but exploding with an exception.
# This is weird behaviour, so we override the on failure proc to go straight to our
# failure method and execute only that.
OmniAuth.config.on_failure = proc do |env|
controller_klass = ActiveSupport::Inflector.constantize('OmniauthCallbacksController')
controller_klass.action(:failure).call(env)
end |
Ok. Will take a moment to have a look on that. |
can you try locking the gem at |
otherwise keep the latest omniauth-spotify and make sure to bump to the latest version of omniauth-oauth2, it seems they have solved this omniauth/omniauth-oauth2#70 |
0.0.6 -> down |
for your information i have the same issue with rspotify.... |
maybe you can try this option https://github.com/intridea/omniauth-oauth2/pull/82/files |
last one did the trick. perfect :) |
Can't get over it. I used 0.0.8 or 0.0.9. I can't debug.
This is the yaml of the call:
https://accounts.spotify.com/api/token
:raise_errors: true
:parse:
:body:
grant_type: authorization_code
code: AQCvXf4SDk2HiltAatn18IagKOC871rSk18E7vm-Lp9rHATXPXhfxEqAy7Yl50MQp3dypdWAA1iY1rc01glsouYhxuFAcH7TBGEMlK6EJMwCfxn7Ldz-3rn5b1XNWyXEYyESXiNS6O9rpbtdZSYr0WCywgBTva_Owv-3Og1CaNdXdef9hDzdNPhYHfL7zR61dKUJDSXkbeiK4cOjZIe9hKGcNnMW1QSWUhKE
client_id: xxx
client_secret: xxxx
:redirect_uri: http://backupmyplaylistsdev.net/auth/spotify/callback?code=AQCvXf4SDk2HiltAatn18IagKOC871rSk18E7vm-Lp9rHATXPXhfxEqAy7Yl50MQp3dypdWAA1iY1rc01glsouYhxuFAcH7TBGEMlK6EJMwCfxn7Ldz-3rn5b1XNWyXEYyESXiNS6O9rpbtdZSYr0WCywgBTva_Owv-3Og1CaNdXdef9hDzdNPhYHfL7zR61dKUJDSXkbeiK4cOjZIe9hKGcNnMW1QSWUhKE&state=10715cde9e932fd315f9d4da58e78b39a67c3384c1585c3b
:headers:
invalid_grant: Invalid redirect URI {"error":"invalid_grant","error_description":"Invalid redirect URI"}
The text was updated successfully, but these errors were encountered: