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