You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
not sure if I am right, but I think you have to override the Devise controller action which causes the redirect. Please someone correct me if I am wrong
I found solution. You need to override devise failture_app. That is how you can make different behavior for website and api
# lib/custom_failure.rb
class CustomFailure < Devise::FailureApp
def respond
if request.env['REQUEST_PATH'].start_with?('/api')
http_auth
else
redirect_to new_user_session_path
end
end
end
# config/initializers/devise.rb
config.warden do |manager|
manager.failure_app = CustomFailure
end
Do not forger to load lib folder in application.rb
I have my controller
I expect to it to render json error. But it redirect me to /user/sign_in page of devise.
And what kind of exception you raise?
The text was updated successfully, but these errors were encountered: