MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

How do I verify an external ajax request is coming from a valid myspace user?

Last post 07-10-2008 10:30 AM by rodney. 19 replies.
Page 1 of 2 (20 items) 1 2 Next >
Sort Posts: Previous Next
  • 02-05-2008 2:01 AM

    • andy
    • Top 150 Contributor
    • Joined on 02-05-2008
    • Posts 33

    How do I verify an external ajax request is coming from a valid myspace user?

    I have a game where a user has some stats that they need to download from my server into the myspace app via javascript.  I don't want people to be able to change the request and get data for a random user.  How would I know that this request is coming from a valid logged in myspace user?  Is there a key I should include in the request so I can verify it? 

    Filed under:
  • 02-05-2008 2:08 AM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    You can use the makeRequest to call a proxy to get the data from your external website to get information. This request requires that you have a valid opensocial token. This validates that its a real user request. Find more information about this here: http://developer.myspace.com/community/myspace/myopenspace.aspx#MyOpenSpace.MySpaceContainer.makeRequest Also check out this thread: http://developer.myspace.com/Community/forums/t/37.aspx -V
  • 02-05-2008 2:57 AM In reply to

    • andy
    • Top 150 Contributor
    • Joined on 02-05-2008
    • Posts 33

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     Hi Viphak,

    When I make a makeRequest call to my url, I want to make sure that the opensocial_viewer_id making the request is actually allowed to get that information (or post it) and it's not someone just spoofing the request by knowing my myspace id?


    I see that some params like opensocial_token and opensocial_url are included in the post to the proxy, but the only request params sent to my php server file are opensocial_owner_id and opensocial_viewer_id.

    How do I verify on my server page that the user is allowed to see or do that request?

     

     Thanks!

    Andy 

  • 02-05-2008 11:05 AM In reply to

    • Paul
    • Top 75 Contributor
    • Joined on 02-01-2008
    • Posts 51

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     Hi Andy,

     When you call the makeRequest function, you can pass in a value for the AuthType parameter of SIGNED and the request through the proxy to your server will be digitally signed according to the OAuth spec.  The oauth_consumer_key is your application URI and the key is the consumer key we provide you upon application creation.  In that way, you can be assured of the opensocial_owner_id and opensocial_viewer_id values and that the request came from our servers.  Hope that helps....you can use the OAuth tool to test requests to your servers.

     ~Paul

  • 02-05-2008 1:12 PM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    When will the AuthType parameter be implemented?
  • 02-05-2008 1:39 PM In reply to

    • andy
    • Top 150 Contributor
    • Joined on 02-05-2008
    • Posts 33

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     alright, I tried doing this SIGNED thing, but I get the error "opensocial.ContentRequestParameters.AuthenticationType has no properties".  I'm guessing because it's not implemented?  Code is below.

        opensocial.Container.get().makeRequest(
    			"http://mysite.com", 
    			function(content) 
    			{
                              target.innerHTML = content;
    			},
                            opensocial.ContentRequestParameters.AuthenticationType.SIGNED);
    	}
     
     
     
  • 02-05-2008 1:48 PM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     I think it's supposed to be

    opensocial.ContentRequestParameters.AuthorizationType.SIGNED
  • 02-05-2008 2:04 PM In reply to

    • andy
    • Top 150 Contributor
    • Joined on 02-05-2008
    • Posts 33

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    I changed it to:

     var params = {};
              params[opensocial.ContentRequestParameters.AUTHENTICATION] = opensocial.ContentRequestParameters.AuthorizationType.SIGNED;
    
    	    opensocial.Container.get().makeRequest(
    			"http://mysite.com", 
    			function(content) 
    			{
                              target.innerHTML = content;
    			},
                            params);
    

    No errors now, but I still don't see any extra POST or GET parameters.

  • 02-05-2008 2:11 PM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     It looks like most of the makeRequest options haven't been implemented yet. Just be patient.. :)

  • 02-05-2008 2:13 PM In reply to

    • Tom
    • Top 500 Contributor
    • Joined on 02-05-2008
    • Posts 15

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    I have been wondering about this myself. This seems like a MySpace specific implementation and won't work on other open social containers.

    Nevertheless, I would be very interested in the code for a working example of hitting a url that authenticates a userid.

  • 02-12-2008 7:44 PM In reply to

    • Mark
    • Top 50 Contributor
    • Joined on 02-05-2008
    • Posts 72

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    Has anybody had any success with this yet?  I can set the authentication to AuthorizationType.SIGNED, but it still doesn't seem to send any additional OAuth parameters to my app.  Any pointers would be appreciated.

     Thanks

  • 02-13-2008 9:09 AM In reply to

    • Egg
    • Top 50 Contributor
    • Joined on 02-05-2008
    • Posts 73

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    Ditto. Even a shell of a document outlining what these might look like so I can get the logic in place and ready for when it does get turned on would be helpful. BTW: I'm really happy to see this coming - this was the biggest weakness of OpenSocial IMO.
  • 02-13-2008 2:51 PM In reply to

    • Mark
    • Top 50 Contributor
    • Joined on 02-05-2008
    • Posts 72

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     How can I go back and view what the consumer secret is for my app?  When I view the details for my app all it has is the "Application Domain".  Is this the same thing?

    Thanks 

  • 02-18-2008 10:09 AM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

    any updates on this? ETA on myspace implementation and anyone gettting it to work?

     

    I am still getting empty oauth_token and oauth_signature on a signed request

     


     

  • 02-26-2008 12:42 PM In reply to

    Re: How do I verify an external ajax request is coming from a valid myspace user?

     It is my experience, that any combination of the above does not work.

     

    I have not, once, ever (is that clear :)?) gotten even a blank oauth anything.

     

    I tried putting it on the url, I tried putting it as opt_params to the makeRequest call.

     

    0.000% of the time, do I get any params, empty or not, added ot the call.

     

Page 1 of 2 (20 items) 1 2 Next >