Jersey verify_credentials error when using include_email



I’m using JAX-RS Client for my server to make API calls to Twitter. I can request account/verify_credentials and it returns the info. But if I put the “?include_email=true” parameter, I always get an error (Could not authenticate you).
The request works fine on curl or postman, but it won’t work on javax Client


Can you share any further code? I wonder whether the Java client is not encoding the parameter correctly as part of the OAuth dance.


Sorry for being late…Here’s the code:


WebTarget webResource =;
    	Response clientResponse = webResource
    			.queryParam("include_email", "true")

apiUrl =

If i remove the .queryParam("include_email", true) line, the code works fine. Thanks!


Are you able to do any tracing to see whether .queryParam("include_email", true) is indeed being passed as a ? style query parameter on the URL? It has been a really long time since I did any coding with*!


The include_email is passed in the GET request. I’ve also tried to target as the API url, but still the same error.

Don’t know if this helps, but I’ve tried a different call for client:

return apiUrl )
		.queryParam("include_email", true)
		.header("Authorization", authHeader)
		.get( Map.class );

and this time it gives HTTP 401 Authorization required error, although the Authorization header is correct.


Can you try changing the value of include_email from a boolean to a string?


I’ve tried that, but still doesn’t work


How are you generating authHeader? Are you making sure that the include_email parameter is getting included in the signature base values?


Well, I didn’t put the include_email in the signature parameters so that might be it. But without the email parameter, the authHeader is good, I can make requests with it. I’ll add the change to the signature monday and see if it’s solved, thanks

EDIT: You were right, I didn’t include the email parameter when generating the signature. but it works now. Thanks !

closed #10