简体   繁体   中英

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 :

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. So you have to pass those parameter with your request.

No there is not any way for calling revoke endpoint without ClientId and ClientSecret.

You can find your ClientId and ClientSecret in your IdentityServer's configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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