Hello,
I am using a guest auth to fetch the last tweet of a user in an android app. The problem that i am facing is that it seems to work initially but after some time, i keep getting 403 Forbidden code in the REST api call.
I am using the following code:
Fabric.with(this, new Twitter(authConfig));
TwitterCore.getInstance().logInGuest(new Callback() {
@Override
public void success(Result result) {
final AppSession guestAppSession = (AppSession) result.data;
TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
twitterApiClient.getStatusesService().userTimeline(null, screen_name, 1, null, null, true, false, false, true, new Callback<List<Tweet>>() {
@Override
public void success(Result<List<Tweet>> listResult) {
// Toast.makeText(MainActivity.this, "Success", Toast.LENGTH_LONG).show();
List<Tweet> tweets = listResult.data;
int i = tweets.size();
int count = 0;
while (count < i) {
Toast.makeText(MainActivity.this, tweets.get(count).text, Toast.LENGTH_LONG).show();
count++;
}
TwitterCore.getInstance().logOut();
}
@Override
public void failure(TwitterException e) {
Toast.makeText(MainActivity.this, e.toString(), Toast.LENGTH_LONG).show();
}
});
}
@Override
public void failure(TwitterException exception) {
// unable to get an AppSession with guest auth
Toast.makeText(MainActivity.this,"FAILURE_F",Toast.LENGTH_LONG).show();
}
});
Can somebody please help me out.
Warm Regards,
Gulati