How to Enhance DisplayFriends?

2 views
Skip to first unread message

Kushal

unread,
Jan 9, 2009, 5:36:22 AM1/9/09
to opensocial-client-libraries
Hey,
I have successfully executed the sample application provided in
opensocial-java-client.
Now m planning to modify it as per my self-build application.
Can anyone help me to sort out my following queries.
1]How to obtain CONSUMER_SECRET,CONSUMER_KEY?
2]How to obtain & use VIEWER_ID from url and use as a parameter of
methods in application?

Janardhan

unread,
Jan 9, 2009, 7:54:42 AM1/9/09
to opensocial-client-libraries
Hey Kushal,

Check this Url, U will get CONSUMER_SECRET,CONSUMER_KEY?

https://www.google.com/gadgets/directory/verify

Regards,
Janardhan

Dan (Google Employee)

unread,
Jan 9, 2009, 2:20:14 PM1/9/09
to opensocial-client-libraries
Hi Kushal,

The best way to get the VIEWER_ID depends on how you are using the
client library.

If you are using the client library to do offline processing of social
data (updating cached thumbnails, etc.), when a user installs your
application, you should send a signed makeRequest to your server with
their ID. You should then save these IDs for later usage in the client
library.

If you are trying to emulate a type="url" gadget, you will need to set
up a bit of bootstrap code in order to securely get the VIEWER_ID.
Note that isn't a recommended use case, as the performance will be
slower than using a pure JavaScript gadget that uses signed
makeRequest to connect to your server. Here is a quick outline of the
steps:
1. Gadget loads in orkut.
2. Gadget sends a signed makeRequest to your server, which has the
viewer and owner IDs automatically appended.
3. Server validates the authenticity of makeRequest and temporarily
stores the viewer and owner IDs, associating them with a temporary
token.
4. Server constructs a URL which, when used in an iframe, will display
your application, and appends the temporary token to that URL.
5. Server returns URL to the gadget in orkut.
6. Gadget constructs and loads an iframe using the URL returned by the
server.
7. When the iframe loads, the server fetches the temporary token from
the URL, uses it to reference the viewer and owner IDs, then stores
these in a session.
8. The viewer and owner IDs are then removed from the temporary
storage to make sure a replay attack cannot occur.

After step 7, you have the viewer and owner IDs for the installed
application and you can use these in the client library to fetch
social data. These steps are slightly complicated, so if this is the
route you are going, I can share some of the gadget-side code to get
this to work.

Dan

Kushal

unread,
Jan 10, 2009, 2:27:42 AM1/10/09
to opensocial-client-libraries
Hi Dan,
Thank you for the reply.I read ur mentioned steps to access
social data.As m trying to build an application to access social data
for the 1st time I would like to work with the procedure which u have
mentioned.But as u said these steps are bit complicated for 1st timer
developer like me.So if u can share some more information ,a little
more detailed step by step approach thn it would be great.Also I have
query that can I use or modify the sample eg in opensocial-java-client
and access data through command line interface.

Awaiting for ur reply.
Thank you
-Kushal

On Jan 10, 12:20 am, "Dan (Google Employee)" <api....@google.com>
wrote:

Kushal

unread,
Jan 11, 2009, 6:33:09 AM1/11/09
to opensocial-client-libraries
Hi Dan,
Couple of days back i replied to ur response an my problem.U
had mentioned abt sharing some gadget-site code with me,so still
awaiting for ur response.Thanks.

Kushal

unread,
Jan 14, 2009, 2:28:10 PM1/14/09
to opensocial-client-libraries
Hi Dan,
Need ur help.M trying to run open-social-javaclient
libraries using my own credentials in DisplayFriends.java eg
M encountering followin errors.M gettin code 401 error i.e
Unauthorized access to my frnd list.Can u plz help me out where m I
goin wrong

{"id":"people","error":{"message":"unauthorized: No access to
friends","code":401}}

org.opensocial.client.OpenSocialRequestException: Entry not found
at org.opensocial.client.OpenSocialJsonParser.getEntryArray
(OpenSocialJ
onParser.java:217)
at
org.opensocial.client.OpenSocialJsonParser.parseAsPersonCollection(O
enSocialJsonParser.java:152)
at
org.opensocial.client.OpenSocialResponse.getItemAsPersonCollection(O
enSocialResponse.java:81)
at org.opensocial.client.OpenSocialClient.fetchFriends
(OpenSocialClient
java:157)
at DisplayFriends.main(DisplayFriends.java:54)
org.opensocial.client.OpenSocialRequestException: Entry not found

On Jan 10, 12:20 am, "Dan (Google Employee)" <api....@google.com>
wrote:
Reply all
Reply to author
Forward
0 new messages