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

No HTML for omniauth_external_window view in Rails 5 API #830

Closed
thorsteneckel opened this issue Feb 10, 2017 · 5 comments
Closed

No HTML for omniauth_external_window view in Rails 5 API #830

thorsteneckel opened this issue Feb 10, 2017 · 5 comments

Comments

@thorsteneckel
Copy link

Version: 0.1.39
Devise 4.2.0
Rails 5.0.0.1 API

I had the issue that no HTML (of the omniauth_external_window view) was rendered after a successful OmniAuth redirect.

This is because all Devise controllers inherit by default from ApplicationController which inherits from ActionController::API by default/in my setting. But ActionController::API can't render HTML. So the trick is to add the following lines to config/initializers/devise.rb:

Devise.setup do |config|
  config.parent_controller = 'ActionController::Base'
end

This worked for me. There were some other obstacles I had to take but those could be found via googleing the error messages.

@louism517
Copy link

Thanks for this, this was the final piece of a 2-day puzzle for me!

@skoropadas
Copy link

Omg, thanks! You save my day!

@skoropadas
Copy link

Guys, I found a new problem. If you use a Rails 5 API, then the before_action :configure_permitted_parameters, if: :devise_controller? will not work. Because the Rails 5 API inherits the ActionController::API and not the ActionController::Base.

@zachfeldman
Copy link
Contributor

Seems like this has been solved/worked around, closing for now.

@ljesus
Copy link

ljesus commented Mar 28, 2021

This should be added to the FAQ or docs. I spent a couple of hours wondering why it wasn't working and debugging the code, until I came to the conclusion that the HTML template wasn't being properly rendered. Thank you for the fix.

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

5 participants