Asp.net 为什么我的id_令牌在单击注销按钮时丢失

Asp.net 为什么我的id_令牌在单击注销按钮时丢失,asp.net,openid-connect,dotnetopenauth,Asp.net,Openid Connect,Dotnetopenauth,我正在使用OpenIdConnect,需要使用外部登录提供程序 在身份验证的回调函数中,我有以下几行代码来获取id_令牌,并需要将其保存在登录提供者在注销过程中请求的某个位置。因此: List<AuthenticationToken> tokens = context.Properties.GetTokens().ToList(); tokens.Add(new AuthenticationToken() {

我正在使用OpenIdConnect,需要使用外部登录提供程序

在身份验证的回调函数中,我有以下几行代码来获取id_令牌,并需要将其保存在登录提供者在注销过程中请求的某个位置。因此:

List<AuthenticationToken> tokens = context.Properties.GetTokens().ToList();

            tokens.Add(new AuthenticationToken()
            {
                Name = "id_token",
                Value = response.IdentityToken
            });
            context.Properties.StoreTokens(tokens);
    
            var id = new ClaimsIdentity(userInfo.Claims);
            principal.AddIdentity(id);

            await context.HttpContext.SignInAsync(principal, context.Properties);
但是,当单击注销按钮时,我需要检索id_令牌并发送到loginProvider以结束与它们的会话。我尝试了以下两种方法,它们都返回null:

        var id_token_hint1 = await HttpContext.GetTokenAsync(IdentityConstants.ExternalScheme, "id_token");
        var id_token_hint1 = await HttpContext.GetTokenAsync("id_token");
我做错了吗?我是否需要手动将此令牌保存到登录控制器中的某个cookie或其他内容中?我的理解是如果我
options.SaveTokens=true设置openIdConnect时,它会自动为我保存此信息

        var id_token_hint1 = await HttpContext.GetTokenAsync(IdentityConstants.ExternalScheme, "id_token");
        var id_token_hint1 = await HttpContext.GetTokenAsync("id_token");