.build();
Form form = new Form().param("grant_type", "client_credentials");
ResteasyWebTarget target = client.target("https://localhost:8443/auth-server/j_oauth_token_grant");
// this is resteasy specific, check spec to make sure it hasn't added a way to do basic auth
target.register(new BasicAuthentication("bburke@redhat.com", "password"));
AccessTokenResponse res = target
.request()
.post(Entity.form(form), AccessTokenResponse.class);
try
{