2

I am creating a twitter social login feature for my Java web application, am using the Scribe library.

Following the library tutorial here for verifying the user credentials, you will be able to retrieve the user credential as json object.

The retrieved json object doesn't have the user email, after researching for how to retrieve the email, i found this documentation in twitter api's.

Now, translating the document with the scribe api's didn't work, and still not able to get the email.

I tried all of the following:

OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");

request.addBodyParameter("include_email", "true");
//OR
request.addQuerystringParameter("include_email", "true");

service.signRequest(accessToken, request);

Response response = request.send();
String result = response.getBody();

Any idea how to retrieve the email using scribe will be appreciated.

Regards

Salah
  • 8,567
  • 3
  • 26
  • 43
  • Maybe.. just maybe, your apps is not whitelisted with twitter ? – Ferdinand Neman Sep 02 '15 at 08:40
  • @FerdinandNeman I don't know what exactly you mean by `"whitelisted with twitter"`. – Salah Sep 02 '15 at 08:53
  • Well, from twitter API you've provided, it says _Requesting a user’s email address requires your application to be whitelisted by Twitter_ , means that your application must be registered with Twitter, then twitter will allow you to extract some user credential. – Ferdinand Neman Sep 02 '15 at 08:59
  • Ok, then do you have any idea to make my twitter app whitelisted ? – Salah Sep 02 '15 at 09:03
  • You can register your application [Here](https://apps.twitter.com/) so that your application can use Twitter's REST API. – Ferdinand Neman Sep 02 '15 at 09:07

0 Answers0