def authenticate_using_http_token
    return if current_user
    authenticate_with_http_token do |token_code, options|
      auth = Tokens::Api.authenticate token_code

      # NOTE: Setting the instance variable directly bypasses the session
      #       setup. Tokens are generally used in API contexts, so the session
      #       cookie would get ignored anyway.
      @current_user = auth unless auth.kind_of? Symbol
    end
  end
def authenticate_using_http_token
    return if current_user
    authenticate_with_http_token do |token_code, options|
      auth = Tokens::Api.authenticate token_code

      # NOTE: Setting the instance variable directly bypasses the session
      #       setup. Tokens are generally used in API contexts, so the session
      #       cookie would get ignored anyway.
      @current_user = auth unless auth.kind_of? Symbol
    end
  end
The before_action that implements authenticates_using_http_token.

 If your ApplicationController contains authenticates_using_http_token, you
 can opt out in individual controllers using skip_before_action.

     skip_before_action :authenticate_using_http_token