Skip to content

Instantly share code, notes, and snippets.

@mockra
Created January 19, 2014 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mockra/8512444 to your computer and use it in GitHub Desktop.
Save mockra/8512444 to your computer and use it in GitHub Desktop.
class SessionsController < ApplicationController
def create
user = User.find_by_email params[:username]
if user && user.authenticate(params[:password])
render json: { access_token: user.access_token }
else
render json: {}, status: 401
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment