Class: AuthController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- AuthController
- Defined in:
- app/controllers/auth_controller.rb
Overview
This class has authentication methods that will generate a JWT for the client to hold
Instance Attribute Summary
Attributes inherited from ApplicationController
Instance Method Summary (collapse)
Instance Method Details
- (Object) authenticate
6 7 8 9 10 11 12 13 |
# File 'app/controllers/auth_controller.rb', line 6 def authenticate user = User.find_by_credentials(params[:email], params[:password]) if user render json: authentication_payload(user) else render json: { errors: ['Invalid email or password'] }, status: :unauthorized end end |