Эти токены будут сохранены в AuthenticationProperties
в файле cookie:
var claims = new List<Claim>
{
new Claim(ClaimTypes.Name, "xxxx"),
new Claim("FullName", "xxxxx"),
new Claim(ClaimTypes.Role, "Administrator"),
};
var claimsIdentity = new ClaimsIdentity(
claims, CookieAuthenticationDefaults.AuthenticationScheme);
var tokens = new List<AuthenticationToken>
{
new AuthenticationToken {Name = OpenIdConnectParameterNames.AccessToken, Value = "xxxxxxxxxxxxxxx"},
new AuthenticationToken {Name = OpenIdConnectParameterNames.RefreshToken, Value = "xxxxxxxxxxxxxxxxxx"}
};
var authProperties = new AuthenticationProperties();
authProperties.StoreTokens(tokens);
await HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
и получены:
var access_token =await HttpContext.GetTokenAsync(CookieAuthenticationDefaults.AuthenticationScheme, "access_token");