I went to my application page and the checked the checkbox for “Request email addresses from users” , it said the application setting were updated. But, using twitter4j, I still get a null result from the user object when I verify the user. Is that a problem with the api I am using or is it something else? Do I need to do something else specific to get the email address, beyond checking the checkbox?
You need to:
- reauthenticate the user so the token is refreshed with the new permissions
- called the verify account endpoint with the
?include_email=trueparameter set. Note that this is a string value, not a boolean.
I am using twitter4j. And I have hacked into the source and looked and the request string it sends to twitter to make the request and it includes “?include_email=true”. But still it returns null for the email. Since I am still trying out the authentication flow, I am getting a fresh token every time I run the servlet anyway. So I cannot think that that is the problem.
I don’t know if it makes any difference but the request headers include “Accept-Encoding;gzip”.
Try the latest Snapshot version of Twitter4J - or the latest version on github. This Pull request: https://github.com/yusuke/twitter4j/pull/230 added support for the email field.
I had been using version 4.0.4 but when I realize the email did not come with the user, I downloaded 4.0.5. SNAPSHOT, and that is what I am using now.