This question is continuation of my previous question: Twitter Rest API integration in hybrid mobile app
I am developing twitter integration in hybrid app and so far i completed search tweets with server side app (Twitter4j) and trying “login with twitter”.
How do i develop login with twitter using server side or can i do that without server side ?
public String authorize() {
Properties prop = new Properties();
String propFileName = "twitter4j.properties";
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
try {
if (inputStream != null) {
prop.load(inputStream);
} else {
throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
}
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(prop.getProperty("oauth.consumerKey"))
.setOAuthConsumerSecret(prop.getProperty("oauth.consumerSecret"))
.setOAuthAccessToken(null)
.setOAuthAccessTokenSecret(null);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
RequestToken requestToken = twitter.getOAuthRequestToken();
System.out.println(requestToken.getAuthorizationURL());
} catch (TwitterException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
From the above method i got authorization URL and Sending this URL to mobile app so that user can authorize app.
After authorization how do get Access Token ?
Thanks