Need to clear one concept. Created android Twitter app via Twiiter4j. When status update is made it posts using account holder of Twitter Application (i.e. who owns the key). Is this how it should be even if I login using another user account?


#1

Need to clear one concept. Created android Twitter app via Twiiter4j. When status update is made it posts using the account of owner of Twitter Application (i.e. who owns the key and creator of the app from twitter site) instead of current user’s. Is this how it should be even if I login using another user account?

I thought if I logged in with another account, it will post status using current users’s account after authentication and authorization but it’s not so. I found the same thing with Facebook application too.


#2

This sounds like a misconfiguration or coding issue. Make sure that when you authorize another user, you persist their access token and leverage it when making requests on their behalf. It sounds like you’ve hardcoded or otherwise persisted the access token belonging to the application owner instead.


#3

Thank you for the quick reply. Yes, I have hard coded and did the mistake. I am new to this integration concept so please forgive me for the grave error. I went through the examples and followed this method

ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("…")
.setOAuthConsumerSecret("…")
.setOAuthAccessToken("…")
.setOAuthAccessTokenSecret("…");

To narrow down the error, are the last two setups setOAuthAccessToken and setOAuthAccessTokenSecret to be done using the user’s data after login unlike others?


#4

Correct, that sounds right (I’m not super familiar with twitter4j.

The consumer key and secret represents your application.

The access token and access token secret represents your end-user and their relationship with your application.


#5

Thanks! It’s clear now :slight_smile:


#6

@zakimak
if you conenct your android app with twitter tell me how