Hi all, I’m using Clearance for my authentication and I want to have my iPad app login.
I set up a session controller with methods called api_authentication and api_signout
def api_authenticate
@user = User.authenticate params[:email], params[:password]
sign_in(@user) do |status|
if status.success?
some_code?
else
some_code?
end
end
end
def api_signout
end
I’m a bit confused about what my api_authenticate method should return. What do I need to send back so my app will be logged in? Also what’s best practice, should I be using the sign_in method, or perhaps just returning the data I want to use (like user_id associated with current_user) as a json object?
Any advice/code/articles/ appreciated!
-Roneesh