How to add Twitter support for Opensocial on a Apache Tomcat (Liferay)?

╄→гoц情女王★ 提交于 2020-01-17 07:28:01

问题


i recently upgraded to Liferay 6.1(b4 from the trunk 17.11.2011) to test the Opensocial support. Now i wanted to make a Twitter Oauth request, but i am not able to do this. I first tested if Opensocial works with some sample gadgets, but i get a error from every gadget.

Error: 403 Error, OAuth error: NOT_OWNER, Non-Secure Owner Page. Only page owners can grant OAuth approval ==== Original request: GET /1/account/verify_credentials.json Host: api.twitter.com X-Shindig-AuthType: oauth X-Forwarded-For: 87.139.78.177 X-shindig-dos: on ====

My Idea now was to build a gadget by myself, but one of the first steps wanted me to add a provider to the "org.opensocial.client.OpenSocialProvider" Class, I got this from here. So the Problem now is that i dont know how to add the support for Twitter, i guess i have to add it somewhere in the WEB-INF/classes/com/liferay/opensocial directory, but i have no clue where exactly.

This is important because i wanted to make many oauth requests from one gadget and if i have to add another Feature which requiers Oauth it would be easier to have a gadget which provides all Oauth Calls.

A Example how to add a Provider and how to make the Oauth call would be awesome, thanks in advance.


回答1:


Add the gadget to a private page like "My Private Page". Currently you can only add OAuth gadgets to pages where you are the owner, hence the error "Only page owners can grant OAuth approval".

This is by design from the underly Shindig implementation for security purposes.

If you haven't seen it already, you can follow these steps to add OAuth gadgets on Liferay: link. It will show you how to add the consumer key/secret from a provider. It also references a sample Twitter gadget.



来源:https://stackoverflow.com/questions/8255016/how-to-add-twitter-support-for-opensocial-on-a-apache-tomcat-liferay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!