MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Protecting your URLs that return data

Last post 07-01-2009 10:51 PM by Michael. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-29-2009 3:10 PM

    • Thomas
    • Not Ranked
    • Joined on 04-24-2009
    • Posts 1

    Protecting your URLs that return data

    When requesting data from our webserver using the opensocial API call makeRequest, we can either post or get data using the code below

    function getFriendList() {
    var url = 'http://apps.yo.com/widgets/send_item/opensocial/profile_summary?user_id=' + gViewer.getId();
    var params = {};
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
    gadgets.io.makeRequest(url, getFriendListCallback, params);
    }



    As we can see, looking at the source of our page anyone can use the url to create they're own apps.

    I can use $referrer = $_SERVER['HTTP_REFERER']; in PHP to know the request is coming from MySpace and so block any requests from other domains.

    But what is there to stop another MySpace Dev from creating an application that uses my webserver?
  • 05-31-2009 8:47 AM In reply to

    • Chak
    • Top 50 Contributor
    • Joined on 01-14-2008
    • Posts 70
    • MDP Team

    Re: Protecting your URLs that return data

     Hi Thomas:

    You need to use signed makerequest() calls to address this issue which will pass a signature your server.

    You also need to modify your server code to verify the signature passed in to ensure they match (i.e. this will validate that the request originated from Myspace - assuming the consumer secret has not been compromised).

    Please add the following line to the JS code above to make signed requests:

    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;

    Chak


       

     

  • 07-01-2009 10:51 PM In reply to

    Re: Protecting your URLs that return data

     cool, this may be useful to me also, because i dont want people storing and deleting data from my database directly from the site that accesses it, but i need to know how it works so i can impement it =D thanks a lot

Page 1 of 1 (3 items)