method

authenticate_or_request_with_http_token

authenticate_or_request_with_http_token(realm = "Application", &login_procedure)
public

No documentation available.

# File actionpack/lib/action_controller/metal/http_authentication.rb, line 386
        def authenticate_or_request_with_http_token(realm = "Application", &login_procedure)
          authenticate_with_http_token(&login_procedure) || request_http_token_authentication(realm)
        end

2Notes

An Example for using it.

Primus · Jan 8, 20142 thanks

Call it in a before filter in your Base or Application Controller.

before_filter :authenticate_through_api_client

def authenticate_through_api_client # this block should return true or false authenticate_or_request_with_http_token |token,other_options| Apiclient.find_by_client_key(token).present? end end

Sample request type: it expects a token in headers as

Authorization:Token token="your_token_goes_here"

Authorization is the key and Token token="" is value

Article

woto77 · Feb 21, 2014