Get a User's email address from Twitter (Android)

前端 未结 5 1355
悲&欢浪女
悲&欢浪女 2021-01-21 06:49

How can i get email address of a user via twitter API? I\'m using Twitter4j for Sign in with twitter

5条回答
  •  不知归路
    2021-01-21 07:10

    check these links

    https://dev.twitter.com/twitterkit/android/installation

    https://dev.twitter.com/twitterkit/android/log-in-with-twitter

    Write below code after successful login

    TwitterAuthClient authClient = new TwitterAuthClient();
    authClient.requestEmail(session, new Callback() {
       @Override
        public void success(Result result) {
        // Do something with the result, which provides the email address
    }
    
    @Override
    public void failure(TwitterException exception) {
      // Do something on failure
    }
    });
    

提交回复
热议问题