This project is read-only.

Authentication from mobile application

Topics: Core, Writing modules
Jan 17, 2015 at 8:47 AM
I build website on Orchard CMS and each user have name, password and permissions.
I'm going to create Controllers or ApiControllers to provide api for manage orchard data.

How i can organize the process of authentication from mobile application?

User enters name and password on mobile application. What to do next?
Jan 18, 2015 at 9:36 PM
Could you narrow down the question? If you want to authenticated inside the mobile app with whatever method you want (i.e. not relying on Orchard's web authentication) then you could write an API endpoint also for checking users' credentials. See IMembershipService.
Jan 19, 2015 at 2:05 PM
Thanks, Piedone. I used IMembershipService.
Create ApiConroller with Authorize method which sends auth cookie (by SignIn method). And set [Authorize] attribute for other methods.
[AcceptVerbs("GET", "POST")]
public object Authorize(string userName, string password)
    var user = _membershipService.ValidateUser(userName, password);
    if (user == null) {
        return Json(new { Id = 0 });

    _authenticationService.SignIn(user, true);

[AcceptVerbs("GET", "POST")]
public object OtherMethod()
    var user = _wca.GetContext().CurrentUser;
    // ...