Liferay provide us inbuild OpenSocial portal.
Follow below steps and integrate twitter with liferay.
Step 1
Open the OpenSocial configuration page in the Control Panel. First add the gadget URL i.e https://raw.github.com/dejuknow/opensocial-gadgets/master/Twitter/Twitter.xml.
Step 2
For any other gadget's OAuth should be enabled , after that you can see a "Manage OAuth" pop-up option under "Actions". Click on "Managed OAuth".
Step 3
You will see a list of all the services names defined by you in XML. To use these services you need to enter a consumer key and secret key. In our case, we have one service named "twitter". Click on the link.
Step 4
Now, need to retrieve a consumer key and secret key from Twitter. Go to http://dev.twitter.com/apps (sign in if you haven't already) and click on "Register a new application".
Step 5
Fill out all required information.
a. For the "Callback URL", please enter Liferay's default callback URL: "http://myLiferayServer/opensocial-portlet/gadgets/oauthcallback". (replace myLiferayServer with an appropriate value. 127.0.0.1:8080 will work for demonstration sake).
b. For "Default Access Type", select "Read & Write" for need to write access to post status updates.
Step 6
After registration, Twitter will provide with a consumer key and secret as well as the request token URL, access token URL, and authorize URL. Please note the consumer key and secret. Also note Twitter uses the HMAC-SHA1 algorithm.
Step 7
Enter the "Consumer Key" and "Consumer Secret" in the OpenSocial Control Panel. Select "HMAC_SYMMETRIC" for the "Key Type" and click on "Save".
Adding the Gadget
Step 1
Now we ready to add the gadget to a page. Go to "My Private Pages" and click on "Add" -> "More" -> "OpenSocial" and add "Twitter Gadget".
Step 2
Click on "Personalize this gadget" to be redirected to the twitter.
Step 3
Twitter will ask the end user whether your application should be given "the ability to access and update your data on Twitter". You can sign out and sign in with another Twitter account here. Click "Allow".
Step 4
The pop-up window should be close and your gadget should now show the last 40(i.e 20) tweets from your timeline.
Step 5
You can use the gadget to tweet your status.
Note: you can also change the number of tweets to display by clicking on the wrench icon on the upper right and going to "Configuration".
0 Comment(s)