简体   繁体   English

使用身份服务器 4 撤销令牌

[英]Revoke token with identity server 4

Im trying to revoke token using identity server 4, i have only bearer token in my part of code, the problem is that i should use RevokeTokenAsync method, but this take more parameters tha ihave available :我试图使用身份服务器 4 撤销令牌,我的代码部分只有不记名令牌,问题是我应该使用 RevokeTokenAsync 方法,但这需要更多可用的参数:

public async void Logout(string bearerToken)
{
  var client = new HttpClient();

  // request token revocation
  var response = await client.RevokeTokenAsync(new TokenRevocationRequest
      {
        Address = uri,           
        ClientId = clientId,    // ?
        ClientSecret = key,     // ?
        Token = bearerToken
      });
   // manage errors ....      
}

Exist any other way to revocate the token without passing others parameters besides token?除了令牌之外,还有没有其他方法可以撤销令牌而不传递其他参数?

When you are calling IdentityServer's endpoints, you should be authenticated for IdentityServer.当您调用 IdentityServer 的端点时,您应该通过 IdentityServer 的身份验证。 So you have to pass those parameter with your request.所以你必须在你的请求中传递这些参数。

No there is not any way for calling revoke endpoint without ClientId and ClientSecret.不,没有 ClientId 和 ClientSecret 没有任何方法可以调用撤销端点。

You can find your ClientId and ClientSecret in your IdentityServer's configuration.您可以在 IdentityServer 的配置中找到您的 ClientId 和 ClientSecret。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM