Welcome Developers!

in

Welcome!

in

opensocial java client problem

Last post 10-11-2010 1:37 PM by Joel. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-07-2010 3:55 AM

    • Lupa
    • Not Ranked
    • Joined on 10-06-2010
    • Posts 1

    opensocial java client problem

    Hi there,

     

    I´m trying to use the opensocial java client in a desktop application, to get a list of my friends from myspace.

     

    I´ve imported the required libraries an the opensocial code under /java/src/org. Then I´ve written my own class to try to connect to myspace, just like the tutorial http://code.google.com/p/opensocial-java-client/wiki/HowToConnecting said....

    public static void main(String[ args) {
            // TODO Auto-generated method stub
            Provider provider = new MySpaceProvider();
            AuthScheme scheme = new OAuth2LeggedScheme("19723c3a31f74b3599f3e98c78ef9abe", "<consumer secret>");
            Client client = new Client(provider, scheme);
           
            Request request = PeopleService.getViewer();
            try {
               
                Response responses = client.send(request);
                System.out.println(responses.toString());
            } catch (RequestException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }catch (NullPointerException e){
                e.printStackTrace();
            }
           

    Is the first parameter of OAuth2LeggedScheme just the consumer key or is "www.myspace.com/consumer key"?
    Is the Scheme correct, or do I have to use OAuth3LeggedScheme ? As I got the consumer key and secrect from http://developers.myspace.com/, I´ve had to set an external URL and an External Callback Validation. What does this mean?
    Could anybody give me an example please?


    And what is an UserID?

    AuthScheme scheme = new OAuth2LeggedScheme("<consumer key>", "<consumer secret>", "<user ID>");


    Greetings
    Asuka

  • 10-11-2010 1:37 PM In reply to

    Re: opensocial java client problem

     You should only have to use 19723c3a31f74b3599f3e98c78ef9abe - not with any prefix. Callback url is where we send our responses back to you. The userID itself is the number that identifies the user and appears in the profile url like so: http://www.myspace.com/{userID}. The oauth must be three legged in the accessing of user resources since the user must approve of such delegation. Subsequent calls are made with the oauth access token granted in the process.

     

    thanks,

    Joel

Page 1 of 1 (2 items)