public async Task <IActionResult> OAuth(string code, string state) { var userInfo = await _accountBusiness.Authorize(code, state); var claims = new List <Claim> { new Claim(ClaimTypes.Sid, userInfo.Id.ToString().ToEncrypted()), new Claim(ClaimTypes.NameIdentifier, userInfo.UserName), new Claim(ClaimTypes.Role, Enum.Parse(typeof(RoleDesc), userInfo.Role.ToString()).ToString()) }; var token = _jwtHelper.CreateAccessToken(claims); return(Ok(new { AccessToken = token, Expires = TimeSpan.FromDays(1).Days, UserName = userInfo.UserName })); }