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

Authenticate using an HTTP Bearer token, or otherwise render an HTTP header requesting the client to send a Bearer token. For the authentication to be considered successful, login_procedure should return a non-nil value. Typically, the authenticated user is returned.

See ActionController::HttpAuthentication::Token for example usage.

Show source
Register or log in to add new notes.
January 8, 2014 - (v3.0.0 - v3.2.13)
2 thanks

An Example for using it.

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

February 21, 2014
0 thanks