locked
Cookie in web api RRS feed

  • Question

  • User52625461 posted

    Hello All,

    I am registering the user using below method and sign in into  the application using same method

    [AllowAnonymous]
            [Route("Register")]
            public async Task<IHttpActionResult> Register(RegisterBindingModel model)
            {
                if (!ModelState.IsValid)
                {
                    return BadRequest(ModelState);
                }
    
                var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
    
                IdentityResult result = await UserManager.CreateAsync(user, model.Password);
    
                if (!result.Succeeded)
                {
                    return GetErrorResult(result);
                }
                else
                {
                     await SignInManager.SignInAsync(user, isPersistent: true, rememberBrowser: true);
                }
              }
    
                return Ok();
            }

    This method I intend to call from mvc controller and angular js controller(mobile app).

    So my question is on which point should I sign-in the user(in mvc, angular js controller OR in web api ONLY) and also where should I store the user in the cookie.

    Because as per above logic above cookie cannot be used in angular js app ?? Please correct me if I am wrong.

    Thanks for the help !

    Tuesday, November 24, 2015 11:49 AM

All replies