Request email using Twitter SDK: Exception: "Your application may not have access to email addresses

android
fabric
twitterkit
email

#1

We are trying to request email using Twitter SDK in our Android app.
Our twitter app (created via apps.twitter.com) has the Access Level set to “Read, write, and direct messages Can request a user’s email address”.

But we always receive the following Exception:

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.

Following our implementation in our Android app.

  1. In Manifest.xml:
<meta-data
            android:name="io.fabric.ApiKey"
            android:value="OUR_FABRIC_API_KEY"
            />
  1. We have initialized Fabric SDK with the following code:
`TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));

Where TWITTER_KEY and TWITTER_SECRET are the keys listed for our Twitter app.

  1. Then we request authorization and the email with the following code:
TwitterAuthClient client = new TwitterAuthClient();
        client.authorize(activity, new Callback<TwitterSession>() {
           @Override
            public void success(Result<TwitterSession> twitterSessionResult) {
               final Result<TwitterSession> result = twitterSessionResult;
                AsyncTask.execute(new Runnable() {
                    @Override
                    public void run() {
                       TwitterSession session = result.data;
                        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.d("TwitterKit", "email-->" + result.data);

                            }
                           @Override
                            public void failure(TwitterException exception) {
                                // It always rise here 
                                Log.d("TwitterKit", "KO email->" + exception.getLocalizedMessage());
                            }
                        });

                    }

                });
            }

            @Override
            public void failure(TwitterException e) {
                    Log.w("TwitterKit", "KO authorize->" + e.getLocalizedMessage());
           }
        });

We’ve already done the following steps:

  • add links to your Terms and Conditions and Privacy Policy under the Settings tab. Then, we have checked the Request email addresses from users box under the Permissions tab.

  • request to add all fabric permissions to app.

  • revoke and regenerate old access tokens with old permission sets (many times).

Why we still not able to get email?

Thanks in advance.


#2

@bonnell Could you please help us?


#3

Since Google acquired Fabric, I unfortunately can’t dig into the specifics to help out. My best guess is that there is a disconnect between the key being used from Apps.twitter.com and the one in your info.plist.


#4

Does this apply to all accounts, or only to one or two specific accounts? Note that an email will not be returned from the API if it has not been confirmed as valid by the account owner.


#5

Thanks @andypiper for your reply.
We have tested it with two different (confirmed) accounts, with the same results.

Moreover, as described before, our Access Level is set to “Read, write, and direct messages Can request a user’s email address”, but after login we obtain an Access Token with only “Read and write” permission.