Skip to content

Instantly share code, notes, and snippets.

@floriandejonckheere
Created August 13, 2016 09:36
Show Gist options
  • Save floriandejonckheere/1b5ae23954fe3b6927a2f045403c575a to your computer and use it in GitHub Desktop.
Save floriandejonckheere/1b5ae23954fe3b6927a2f045403c575a to your computer and use it in GitHub Desktop.
Allow Devise redirection to Doorkeeper authorization
# config/initializers/doorkeeper.rb
Doorkeeper.configure do
resource_owner_authenticator do
# fail "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
# Put your resource owner authentication logic here.
if signed_in?
current_user
else
# redirect to /oauth/authorize?... after signin
session[:user_return_to] = request.fullpath
redirect_to(new_user_session_url)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment