简体   繁体   中英

How can I skip before action for token validations controller in Devise?

I use before action to require params in every route except auth from Devise. So, I want to skip the before action on token validation. I already skip in session controller and registration controller by overriding them but I don't know how to override the token validation controller.

You can prevent filters from running before particular actions with the skip_before_action callback, like:

skip_before_action :verify_authenticity_token, only: :action

Where action is the method where you want to disable verify_authenticity_token .

Thanks for your help. Actually, I need to override token validation controller for skip the action which runs before validating token. Where the action is the method which I create by myself. For the solution that I got is override TokenValidationsController for adding the skip_before_action which I already used in session controller and registration controller.

class Custom::TokenValidationsController < DeviseTokenAuth::TokenValidationsController
    skip_before_action :action, only: :validate_token
    ...
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM