public async Task <IActionResult> SignInxAsync(string code = null) { var result = await CoreService.Authentication(code); if (!result.IsAuthenticated) { return(RedirectToPage("/index")); } var claims = new List <Claim> { new Claim(ClaimTypes.Name, result.User.Name), new Claim("AvatarId", result.User.AvatarId), new Claim("DiscordId", result.User.DiscordId.ToString()), }; if (StaticSettings.AdminDiscordId == result.User.DiscordId || StaticSettings.DeveloperDiscordId == result.User.DiscordId) { claims.Add(new Claim("AdminUSer", "")); } // claims.Add(new Claim("AdminUSer", "")); //必要に応じてUserを作る var claimsIdentity = new ClaimsIdentity( claims, CookieAuthenticationDefaults.AuthenticationScheme); var authProperties = new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTime.UtcNow.AddDays(10) }; await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity), authProperties); return(RedirectToPage("/index")); }