Developer / Documentation / OpenSocial: which approach to take?
Here we briefly list the different options you can consider when developing an application for Netlog. Consider your approach carefully up front, to avoid running into troubles along the way.
Everything within the Gadget
- It is rather hard in this approach to make requests to your own server. Signing makeRequest() calls is rather cumbersome, and the function cannot run simultaneously in different threads. The answer: leverage persistent storage to the maximum, and don't bother trying to sign your makeRequest calls.
In conclusion, you should use this approach only if the HTML+JS of your app is fairly simple, and you do not
need to store/retrieve data from your own server. Bluntly put:
Read this: Tutorial 5: Flash and OpenSocial
Loading an iframe within the gadget + security token (st) authentication
This allows you to handle everything on your own server, accept for some basic initialisation in the gadget. If your application depends heavily on data that you store on your end, and/or it consists of multiple pages, use this approach.
Loading an iframe within the gadget + 2-legged OAuth authentication
Same as above, but with the added benefit that you can send notifications to the user also when he is not on your application. To be more precise, you will need his user ID to do this, so you can send notifications (and for example, give credits) from your own end after the user used your Netlog application at least once.
The only difference with the above approach is that this time we give you your authentication credentials (OAuth consumer key+token) beforehand, and apart from this you only need the user ID to make OpenSocial REST calls from your own server. This time it is the Netlog user ID that you pass on from within the gadget to your iframe.
Articles for app developersMust-reads:
- Tutorial 1: OpenSocial JS API
- Tutorial 2: OpenSocial REST API
- Tutorial 3: OpenSocial example app
- Tutorial 4: OpenSocial PHP client
- Tutorial 5: Flash and OpenSocial