Thanks. I eventually figured it out through a long process of searching.
Though I am not exactly sure about how to verify the request is coming from myspace in a secure way.
I downloaded the SDK, which looks to be a large library of standard methods I don't particularly need.
You can request auth tokens, but when it comes to verifying them, the user is presented with an approval page? Is this serious? Didn't they approve it when they installed the app?
All I want to do is verify the request is from myspace, then get the user id of the owner of the app and the viewer of the app to compare. Is it really that hard?
I see a lot of responses here are plain and simply: check out our SDK...
I don't know about anyone else, but that is not of much use to me to be handed an sdk and have to audit the code to figure it out. The documentation I found is basically the walkthrough, which provides the example app, which also does the login thing I want to avoid.
Is there a useful documentation anywhere? Or just an answer to how I can authorize the request, and get owner and viewer ids?
solution to original problem:
var os;
var dataRequest;
dataRequestLine(doMakeRequest);
function dataRequestLine(method)
{
os = opensocial.Container.get();
dataRequest = os.newDataRequest();
var param = {};
param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[;
var OWNERReq = os.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER, param);
var VIEWERReq = os.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, param);
dataRequest.add(VIEWERReq, "get_viewer");
dataRequest.add(OWNERReq, "get_owner");
dataRequest.send(method);
}
function doMakeRequest(owner_id, viewer_id)
{
var param = {};
param[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.HTML;
param[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
param[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
param[gadgets.io.RequestParameters.POST_DATA] = {"action":"some_request", "vid":viewer_id, "oid":owner_id};
gadgets.io.makeRequest("http://somedomain.com", gotMakeRequest, param);
}
function gotMakeRequest(response, url, errored)
{
if(!errored) {
c.innerHTML = response.text;
} else {
c.appendChild(document.createTextNode("makeRequest failed:(" + response + ")(" + url + ")(" + errored + ")" + "\r\n"));
}
}
What, <code> tags don't work? how are people posting code here?