I only peeked at your second file since we're working to encourage
developers to use the persistence API rather than gadget user
preferences. Along the same lines, you should replace your legacy
function calls like _IG_FetchXmlContent and _IG_RegisterOnloadHandler
with the new API calls (gadgets.io.makeRequest and
gadgets.util.registerOnLoadHandler respectively).

When the current user does not have a given application installed,
that application can't access the VIEWER object -- this is why you are
seeing the "unauthorized" error. Your other request items should be
returning correctly, however, so you should be able to change your
code to something like:

var viewer;
if (!resp.hadError()) {
  viewer = resp.get('viewer').getData();
}

var owner = resp.get('owner').getData();
var data = resp.get('ownerData').getData();
var ownerData = data[owner.getId()];

if ((ownerData == undefined) || (ownerData['lf_data'] == 'null')) {
  if(!viewer || !viewer.isOwner()) {
    ...
  } else {
    ...
  }
} else {
  ...
}

If you reference the viewer object In subsequent sections of your
code, you will need to verify whether it exists before you use it.
Otherwise, the revised snippet above should be all you need.

- Jason

On May 21, 1:07 pm, barszcz <[EMAIL PROTECTED]> wrote:
> ok, i tried everything.. i made an application some days ago and it
> had the following structure:
>
> userprefs (with default values)
> the person installed the app and set his data on the userprefs
> for him the app works fine, show his data (i used the user prefs to
> know from what url i need to fetch data)
> but when he is viewing someone elses profile it shows his data
> (getting his userprefs) and if he doesnt have the app it shows the
> default data not what the owner user configured.
>
> the code:http://www.autosistem.inf.br/LastFM.xml
>
> then i tryed to use opensocial api and work directly with the orkut
> data.
> first the person install the aplication, if it runs for the first time
> and he is the owner, the configuration screen will be shown. after he
> config it shows his fetched data and there is an option for him to
> change his configuration (if he is the owner).
> that runned good! until someone without the app try to look at it in
> someone profile. it gives me an unauthorized error (ok, it is in the
> docs :p) and i tryed to pass over it requesting authorization
> (opensocial.requestPermission) didnt work.
>
> the code:http://www.autosistem.inf.br/LastFM3.xml
>
> now i ask.. how i can get it to work? suggestion?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to