Try this, and let me know how it goes:
function callData() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER),
"viewer");
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),
"owner");
req.send(onRequest);
}
function onRequest(data) {
var owner = data.get("owner").getData();
var viewer = data.get("viewer").getData();
alert(owner.getId());
alert(viewer.getId());
}
The owner id is different from uid. It's ok.
Robson Dantas
2010/7/3 Alex Porto <[email protected]>
> Gentlemen,
>
> I've noticed this issue: I can get viewer and owner id's using
>
> req.add(req.newFetchPersonRequest("OWNER"), "get_owner");
> req.add( req.newFetchPersonRequest( 'VIEWER' ), 'get_viewer' );
>
> And then, after the request data arrives,
>
>
> function dataAvailable(data) {
> var ownerData = data.get('get_owner').getData();
> var owner = ownerData.getField( opensocial.Person.Field.ID );
>
> var viewerData = data.get('get_viewer').getData();
> var viewer = viewerData.getField( opensocial.Person.Field.ID );
>
> However, this code isn't working when the viewer isn't the owner. I.e.:
> When I'm watching an app installed on my Orkut account, it return's ok. But
> when other users loads the app on my Orkut profile, the viewerData is
> invalid. I can catch this by data.hadError(), but data.errorMessage()
> returns undefined, as well as viewerData.
>
> Also, I noticed that the owner Id returned in both cases is differente from
> the uid present at Orkut URL.
>
> Any hint's about that?
>
> Thank you,
>
> Alex.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "orkut Developer Forum" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<opensocial-orkut%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/opensocial-orkut?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"orkut Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en.