Twitter Email Request

I am trying to request an email from a user using twitter login and it always returns me the following error.

com.twitter.sdk.android.core.TwitterException: Your application may not have access to email addresses or the user may not have an email address. To request access, please visit https://support.twitter.com/forms/platform. 

I followed all the steps to develop this email request on the fabric page. I requested access to twitter, and they answered me with a confirmation email, and I configured all the necessary elements in the Twitter application control panel, but the email request always sends me a rejection method and throws this exception.

any idea?

 private void twitterConfig() { TwitterAuthConfig authConfig = new TwitterAuthConfig("Consumer Key (API Key)", "Consumer Secret (API Secret"); Fabric.with(this, new Twitter(authConfig)); twitterLoginButton.setCallback(new Callback<TwitterSession>() { @Override public void success(Result<TwitterSession> result) { TwitterSession session = result.data; String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")"; TwitterAuthClient authClient = new TwitterAuthClient(); authClient.requestEmail(session, new Callback<String>() { @Override public void success(Result<String> result) { System.out.println(); } @Override public void failure(TwitterException exception) { notificationManager.showMessage(getString(R.string.error_cant_get_login)); } }); } @Override public void failure(TwitterException exception) { notificationManager.showMessage(getString(R.string.error_generic)); } }); } 
+5
source share
2 answers

As indicated at the bottom of the documentation :

Even if a user provides access to their email address, it is not guaranteed that you will receive an email address. For example, if someone subscribed to Twitter with a phone number instead of an email address, the email field may be blank. When this happens, the opt-out method will be called because there is no email address.

0
source

I Yes, it is true. You need to change the permission settings on the Permission tab inside the selected application.

https://apps.twitter.com/app/PROJECT_ID/permissions

enter image description here Additional permissions

These additional permissions require that you provide URLs to your privacy policies and terms of service. You can configure these fields in the application settings. Request email addresses from users

This will allow a few hours / min after the change.

 TwitterAuthClient authClient = new TwitterAuthClient(); authClient.requestEmail(session, new Callback < String > () { @Override public void success(Result < String > result) { // Do something with the result, which provides the email address Log.v("log_tag", "success email true > " + result.data); } @Override public void failure(TwitterException exception) { // Do something on failure Log.v("log_tag", "success email false > " + exception); } }); 

As neeeko said, it is not guaranteed that you will receive an email address.

thanks

0
source

Source: https://habr.com/ru/post/1236270/


All Articles