valid? development strategies have a valid? , which is called to determine if the strategy should be enabled. This allows you to control the available authentication strategies based on each controller / action.
Put this in the initializer:
require 'devise/strategies/base' require 'devise/strategies/token_authenticatable' module Devise module Strategies class TokenAuthenticatable < Authenticatable def valid? super && params[:controller] == "your controller" && params[:action] == "your action" end end end end
let me know if it works.
source share