Canceling an Access Token

You can cancel an access token at any time by specifying its tokenId, bearing in mind that this will cancel all further access previously authorized by the token.

// Look up and cancel an access token

public static TokenOperationResult cancelAccessToken(Member grantee, String tokenId) {

 

    // Retrieve the token

    Token accessToken = grantee.getTokenBlocking(tokenId);

 

    // Cancel the token

    return grantee.cancelTokenBlocking(accessToken);

}