Created
August 13, 2016 09:36
-
-
Save floriandejonckheere/1b5ae23954fe3b6927a2f045403c575a to your computer and use it in GitHub Desktop.
Allow Devise redirection to Doorkeeper authorization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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