Module: RapidApi::Auth::Concerns::SessionsController

Extended by:
ActiveSupport::Concern
Includes:
JWTHelpers
Defined in:
lib/rapid_api/auth/concerns/sessions_controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from JWTHelpers

#jwt_decode, #jwt_encode

Instance Method Details

#authenticateObject



13
14
15
16
17
18
19
20
21
# File 'lib/rapid_api/auth/concerns/sessions_controller.rb', line 13

def authenticate
  authenticated = _authenticate(permitted_auth_params)
  if authenticated.present?
    render json:   _authentication_response_json(authenticated),
           status: :ok
  else
    render json: { errors: ['Invalid credentials'] }, status: :unauthorized
  end
end