Module: ClientAuthenticator::ApiAuthenticable

Extended by:
ActiveSupport::Concern
Defined in:
lib/client_authenticator/api_authenticable.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_client!Object



7
8
9
10
11
12
13
# File 'lib/client_authenticator/api_authenticable.rb', line 7

def authenticate_client!
  client_id = request.headers['client-id']
  pass_key = request.headers['pass-key']
  if client_id.nil? || pass_key.nil? || (not ApiClient.authenticated?(client_id, pass_key))
    render json: {'error' => 'unauthorized'}, status: :unauthorized
  end
end