简体   繁体   中英

Twitter Fabric Integration 403 Exception

I'm trying to pull Tweets from a specific users timeline on Twitter using Fabric.

I've got the Fabric Studio plugin installed and working.

TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));

TwitterCore.getInstance().getApiClient().getStatusesService()
            .userTimeline(null, "fabric", 10, null, null, null, true, null, false,
                new Callback<List<Tweet>>() {
                    @Override
                    public void success(Result<List<Tweet>> result) {
                        for (Tweet t : result.data) {
                            android.util.Log.d("tweet", t.text);
                        }
                    }

                    @Override
                    public void failure(TwitterException exception) {
                        android.util.Log.d("tweet exception", exception);
                    }
                });

The key and secret are right, based on my account and this code will actually work for a while. Then after a period of time, and after I've made a few changes (not related to the Fabric integration) it will start throwing the following exception.

exception com.twitter.sdk.android.core.TwitterApiException: 403 Forbidden

This has happened 4-5 times and is only solved by re-creating the app from scratch. I'm not sure whether I'm hitting some cap, a time-out or some change I'm making is breaking it. Re-generating and adding the keys does not fix the issue.

you can try this way ..

    TwitterCore.getInstance().logInGuest(new Callback<AppSession>() {
         @Override
         public void success(Result<AppSession> appSessionResult) 
       {
        //Your Code goes here ...........
       }
        @Override
        public void failure(TwitterException e) 
       {

         }
      )};

For More de tail GO HERE

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