Пример #1
0
        public async Task <ActionResult> QQLogin()
        {
            IBLL.IUserManager userManager = new BLL.UserManager();

            var code     = Request.QueryString["code"];
            var token    = GetAuthorityAccessToken(code);
            var dic      = GetAuthorityOpendIdAndUnionId(token);
            var userInfo = GetUserInfo(token, dic["openid"]);

            Dto.UserInformationDto user = await userManager.GetUserByOpenId(dic["openid"], userInfo);


            Response.Cookies.Add(new HttpCookie("userinfo")
            {
                Value   = JsonConvert.SerializeObject(user),
                Expires = DateTime.Now.AddDays(7)
            });


            return(RedirectToAction("Index", "Home"));
        }