Skip to content

Instantly share code, notes, and snippets.

@promisepreston
Created September 7, 2019 12:52
Show Gist options
  • Save promisepreston/ff8904d41baac18dd54a6a47827740e8 to your computer and use it in GitHub Desktop.
Save promisepreston/ff8904d41baac18dd54a6a47827740e8 to your computer and use it in GitHub Desktop.
# app/controllers/authentication_controller.rb
class AuthenticationController < ApplicationController
skip_before_action :authenticate_request
def create
command = AuthenticateUser.call(params[:email], params[:password])
if command.success?
render json: { auth_token: command.result }
else
render json: { error: command.errors }, status: :unauthorized
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment