简体   繁体   中英

Can't log into Twitter from Android app. TwitterException on getting the Email

I have the necessary key and secret, but somehow I'm getting

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 have an email provided with my twitter account, I also read that because I have activated my Twitter via phone number this will not be supplied. If so how do we get these email addresses when they did activate via phone number?

*keys are being used by other platforms and are ok.

** Update, I have signed in with my old twitter account without a phone number in it. It did log in successfully.

Question would be how to fetch the email if they do have the phone number activated?

Upon the exception in your query, It seems you have requested for the email_id of your a/c .

Requesting a user's email address requires your application to be whitelisted by Twitter. To request access, please use this form .

Once whitelisted, the “Request email addresses from users” checkbox will be available under your app permissions on apps.twitter.com . Privacy Policy URL and Terms of Service URL fields will also be available under settings which are required for email access. If enabled, users will be informed via the oauth/authorize dialog that your app can access their email address.

Note

Your app will need to regenerate the user access tokens for previously authenticated users to access their email address.

After doing all these follow the tuts to fetch the email_id

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
    }

    @Override
    public void failure(TwitterException exception) {
      // Do something on failure
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM