public void revokeAccessToken ( Token token ) throws OAuthTokenException , JSONSerializerException , HttpClientException , URISyntaxException , InvalidRequestException { HttpRequest request = new HttpRequest ( ) ; request . setUri ( new URI ( tokenURL ) ) ; request . setMethod ( HttpMethod . DELETE ) ; request . setHeaders ( new HashMap < String , String > ( ) ) ; request . getHeaders ( ) . put ( "Authorization" , "Bearer " + token . getAccessToken ( ) ) ; HttpResponse response = httpClient . request ( request ) ; if ( response . getStatusCode ( ) != 200 ) { throw new OAuthTokenException ( "Token request failed with http error code: " + response . getStatusCode ( ) ) ; } httpClient . releaseConnection ( ) ; }
Revoke access token .