MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Get a connection to MYSPACE

Last post 09-15-2009 1:50 PM by Brandon Black. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-27-2009 8:22 AM

    Get a connection to MYSPACE

    Hi guys!! I downloaded the OpenSocial Java Client, but I can not get a successful connection. Do you have some example code. This is that I have. And I got a HTTP 401 error
    OpenSocialClient client= new OpenSocialClient(OpenSocialProvider.MYSPACE);
    		
    		client.setProperty(OpenSocialClient.Property.DEBUG, "");
    		if (args.length > 0 && args[0].equalsIgnoreCase("REST")) {
    		      client.setProperty(OpenSocialClient.Property.RPC_ENDPOINT, null);
    		    }
    		client.setProperty(OpenSocialClient.Property.CONSUMER_SECRET, "20ab52223e684594a8050a8bfd4b06693ba9c9183ee24e1987be87746b1b03f8");
    		client.setProperty(OpenSocialClient.Property.CONSUMER_KEY, "http://www.myspace.com/496094792");
    		
    		try{
    			OpenSocialPerson person = client.fetchPerson("496094792");
    		} catch (org.opensocial.client.OpenSocialRequestException e) {
    			System.out.println("OpenSocialRequestException thrown: " + e.getMessage());
    			//e.printStackTrace();
    		} catch (java.io.IOException e) {
    			System.out.println("IOException thrown: " + e.getMessage());
    			//e.printStackTrace();
    		}
    
  • 09-15-2009 1:50 PM In reply to

    Re: Get a connection to MYSPACE

    401 actually means that the request that you made is an unauthorized request and it's failing a security check.

    To clarify, are you trying to create an on-site app hosted by MySpace or something hosted externally? You should also check to make sure the user you're trying to access in that sample code (496094792) either has the application isntalled (if its an on-site app) or has granted your application an access token (if its an off-site app).

Page 1 of 1 (2 items)