-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unable to override sessions controller #471
Comments
Get a similar problem. However : The logged |
I was able to workaround this by overriding the def token_validation_response
UserSerializer.new( self, root: false )
end and adding the uid and provider back using my serializer: class UserSerializer < ActiveModel::Serializer
attributes :id, :provider, :uid, :name, :nickname, :image, :email, :created_at, :updated_at
has_one :role
end ...but the issue still stands. If I wanted to override any of the controllers, it's still not working. |
I have this problem with SessionsController as well, I've been able to override Registrations and OmniAuthCallbacks no problem. Been using the same workaround as @dgoradia to serialize the validation response but now I need to get inside the SessionsController#new method, any insight is greatly appreciated. |
+1 |
@dgoradia In your example, you're keying the overrides hash with |
Define full module nesting to overriding controller # confg/routes.rb
mount_devise_token_auth_for 'User', at: 'auth', skip: [:token_validations],
controllers: {
sessions: 'api/v1/devise_token_auth/sessions' # full module nesting
} Define controller in specified file system nesting(to be picked up by autoloading system) # app/controllers/api/v1/devise_token_auth/sessions_controller.rb
module Api
module V1
module DeviseTokenAuth
class SessionsController < ::DeviseTokenAuth::SessionsController
# note :: for loading root constants(::DeviseTokenAuth::SessionsController)
# otherwise you'll get circular dependency error
protected
# custom rendering
end
end
end
end |
@vr4b4c the right would be:
It is controller_S_ and not controller. Am I wrong? P.s: Thanks for your answer |
@kaiomagalhaes you're correct(edited my comment) |
@vr4b4c and it should be:
|
true, apparently my solution has more problems than original issue... ;) |
While implementing what @vr4b4c suggested and writing tests to my api controllers, I now get Any thoughts? |
Hi there @dgoradia and @albertsaave , In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error! If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it. Hope all is well. |
also cant override :( |
Hi @CostaRico, this issue is closed. If you're having a similar problem, please open a new issue with more specifics and we can try to look into it. |
Or any controller. I really just need to override the render methods.
Following from the readme under https://github.com/lynndylanhurley/devise_token_auth#custom-controller-overrides, it just isn't working for me.
app/controllers/api/v1/devise_token_auth/sessions_controller.rb
It doesn't use this controller and just returns the default. Any suggestions would be appreciated!
The text was updated successfully, but these errors were encountered: