Sandbox UserManager Usage with API Application

Notice: This thread is very old.
dqj
Member | 11
+
0
-

I'm trying out Nette as an API backend for an Angular JS app. I see the UserManager class provided with the sandbox, but I can't figure out how to use it. If I have a form post, I can pass it to UserManager::authenticate(), but I'm not sure if that actually logs the user in. Do I just need to call that, or do I call that, and if successful call something else? I wasn't able to find any examples of use for it in the code, even though it is in the sandbox.

old.gandalf
Member | 17
+
0
-

Hello,

if I understand you right, the thing you need to do to properly log the user in is to call the getUser()->login($username, $password) method in your presenter. This method then calls the IAuthenticator::authenticate() method itself.

dqj
Member | 11
+
0
-

Thank you. I think I've got it. I need to circumvent the presentation, because all my interactions are services that provide json objects back to the client.