Welcome Developers!

in

Welcome!

in

MySpace as installed application

Last post 08-04-2009 1:04 AM by Lincoln. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 04-22-2009 12:00 PM

    • Tieto
    • Top 200 Contributor
    • Joined on 04-03-2009
    • Posts 25

    MySpace as installed application

    Hi,

    Good Day!Smile

    We are working on Mobile Application Development. We are analysing the posabilities to simulate myspace as istalled application in mobile ( CPP language). Is it possible to implement? From where we need to start and where we can get information about installed application related information?

     

    1. Can we use OAuth protocol (Installed Applications) to authenticate and access MySpace user  data by providing authentication crendentials via HTTP methods?

    2. Is it possible to do it through OPEN SOCIAL? How to start and where we can get related information about installed applications procedure?

     3. Is there any CPP libraries support by GOOGLE or MY SPACE?

     

    Thanks in advance

    Regards,

    TE

     

  • 04-28-2009 1:11 AM In reply to

    Re: MySpace as installed application

     I don' t know that we officially support that, I'll double check and get back to you.

    Rhonda

  • 04-28-2009 1:18 AM In reply to

    Re: MySpace as installed application

     You can find the list of libraries that we support here: http://wiki.developer.myspace.com/index.php?title=Category:MDP_Libraries

     

  • 04-28-2009 9:16 AM In reply to

    Re: MySpace as installed application

     No, we do not support CPP and we don't have any plans from the future. You an build one for yourself using  the rest endpoints:

    http://wiki.developer.myspace.com/index.php?title=MySpace_REST_Resources

     

  • 05-03-2009 8:42 AM In reply to

    • Hyper
    • Not Ranked
    • Joined on 03-03-2009
    • Posts 6

    Re: MySpace as installed application

    rondata@myspace:

     No, we do not support CPP and we don't have any plans from the future. You an build one for yourself using  the rest endpoints:

    http://wiki.developer.myspace.com/index.php?title=MySpace_REST_Resources

     

     

    I managed to do that for a portable desktop application (win/mac/linux) using libcurl. I managed to log in, and do read only API calls, like get photo albums, get photos in album, get user info, etc. Would be glad to help. OAuth is a bit tricky. There is a OAuth opensource library, but I did not manage to get it to work, and once you know what you have to do, it is not that complicated to implement OAuth on top of libcurl. It is just that documentation is not lacking, specially for c++ programmers. I am stuck with POST requests at the moment. 

     There are other issues that you need to know before you get started, when you register your app, you must enable OpenID (developer.myspace.com->my apps->your app->edit settings->Use OpenID) and you need to fill in your callback url, if you plan to use one (url that login page redirects you to after logging in, we use it to detect a succesful login and to close that window). And you need to publish your app from myapp list. For that you will need app icons, or you won't be able to access any accounts that are not owned by users on your developer or tester list. 

     

    But, I got stuck on creating photo albums. I did exactley as specified here:

    http://wiki.developer.myspace.com/index.php?title=POST_v1_users_userId_albums

     

    I do a POST on

    http://api.myspace.com/v1/users/{userId}/albums

    with parameters:

    location={blank}

    oauth_consumer_key={key}

    oauth_nonce={nonce}

    oauth_signature={signature}

    oauth_signature_method=HMAC-SHA1

    oauth_timestamp=1241364337

    oauth_token={token}

    oauth_version=1.0

    privacy=Me

    title=test 

     

    I got a blank response from the server, but curl returned OK (that means server returned 201 but did not respond), and album was not created. What am I doing wrong? Is it implemented at all? If yes, why doesn't it say so in REST API documentation?

     

    Anyway, it would be nice if there would be a subforum where us, non web developers can discuss how to implement myspace API. 

  • 05-03-2009 9:12 AM In reply to

    • Hyper
    • Not Ranked
    • Joined on 03-03-2009
    • Posts 6

    Re: MySpace as installed application

     Sorry, my mistake, I get error 500... Internal server error. So it is probably a server side issue. I have seen forum posts that upload photos is not implemented yet, from about 2 weeks ago. Is that still true? What about create album? 

    Tx.

  • 05-04-2009 4:15 AM In reply to

    • Tieto
    • Top 200 Contributor
    • Joined on 04-03-2009
    • Posts 25

    Re: MySpace as installed application

     Hi,

    Thanks for your post with clear description what you have done up to yet.

    we are newbie to myspace and we are developing c++ library to access myspace data from mobile. Right now we are able to get oauth_token and oauth_secret_token from tools provided by myspace in "Tools" section. When we are trying to build http request using QT c++ we are unable to get response from the myspace server.

    We also tried with curl command line utility..See below curl command what we are issuing to get oauth_token and oauth_secret_token... If you find any problem please guide us in right direction...

     curl POST http://api.myspace.com/request_token -d Authorization: "OAuth oauth_nonce= 12343212,oauth_timestamp=1241432044,oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=ZhiKYv5aVdpFf6ZqoIeXeC8oroU%3D"


    and we build http header also with

    http->setHost("http://api.myspace.com/request_token") ;

    and  p, li { white-space: pre-wrap; }

    QByteArray header("Authorization:

    OAuth realm=http://api.myspace.com,

    oauth_nonce=132134545,

    oauth_timestamp=1241432044,

    oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,

    oauth_signature_method=HMAC-SHA1,

    oauth_version=1.0,

    oauth_signature=ZhiKYv5aVdpFf6ZqoIeXeC8oroU%3D")

     http->setRawHeader(header);

    http->request(header, QByteArray());

    Here also we are not getting any response from the server.

     

    Please help us to move farward in this front.

    Thanks in Advance

    Regards,

    Tieto.

  • 05-04-2009 5:05 AM In reply to

    • Hyper
    • Not Ranked
    • Joined on 03-03-2009
    • Posts 6

    Re: MySpace as installed application

    Tieto:

     curl POST http://api.myspace.com/request_token -d Authorization: "OAuth oauth_nonce= 12343212,oauth_timestamp=1241432044,oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=ZhiKYv5aVdpFf6ZqoIeXeC8oroU%3D"


    Therecould be few problems, first, your oauth_signature is urlencoded... It usualy ends with '=', which is %3d when urlencoded. I had a similar problem. 

     Also, what is this "Authorization:" string? 

     

    This is my approximate code that works (some of the code was in other methods, I collected most of the code, other then creation of hash and keys. It would take me too much time to translate libcurl calls to curl command line tool calls. 

     list<string> Arguments;

    Arguments.push_back("oauth_consumer_key=" + "123456778"); //application consumer key
    Arguments.push_back("oauth_signature_method=" + "HMAC-SHA1");
    Arguments.push_back("oauth_version=" + "1.0");


    char sKey[20];
    memset(sKey, 0, sizeof(sKey));
    HLGenerateKey(sKey,  sizeof(sKey)-1 ); //function that generates the key
    string strKey = sKey;
    Arguments.push_back("oauth_nonce=" + strKey);
    string sTime = GetTimeStamp();
    Arguments.push_back("oauth_timestamp=" + sTime);

    string sArgList = GetArgumentsString(Arguments, true); //sorts the arguments and creates a string from a list

    string sHash = GenerateHash("POST",
    "http://api.myspace.com/request_token", sArgList); //generates SHA1 hash
    Arguments.push_back("oauth_signature="+sHash);

       
    curl_easy_reset(hCurl);
    curl_easy_setopt(hCurl, CURLOPT_URL, "http://api.myspace.com/request_token");
    curl_easy_setopt(hCurl, CURLOPT_POST, true);
    curl_easy_setopt(hCurl, CURLOPT_POSTFIELDS, sArgList.c_str());
    curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, sArgList.length());
    curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, CURLWriteStrCallback);
    curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, &sResult);
    CURLcode res = curl_easy_perform(hCurl);
    if (res != 0)
       return false;
           
    long responseCode = 0;
    curl_easy_getinfo(hCurl, CURLINFO_RESPONSE_CODE, &responseCode);
    if(responseCode != 200 && responseCode != 201)
        return false;

     

    My first guess is that the problem is that your signature is urlencoded, '%3d' instead of '='. That should be trivial to try (I had the same problem). Other is that you are not generating hash from all oauth options, or from wrong url, or perhaps your arguments are not sorted...

  • 05-05-2009 5:50 AM In reply to

    • Tieto
    • Top 200 Contributor
    • Joined on 04-03-2009
    • Posts 25

    Re: MySpace as installed application

     Hi Hyper,

    Thanks for ur quick reply.

     

    actually yesteraday night we are able to success in curl command execution...

    i modified the command like below

    curl --silent --header "Authorization: OAuth oauth_nonce= 12343212,oauth_timestamp=1241514332,oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=WN8oy0CwYjW3tVJEPXdQM7HH5RQ%3D" \
    "http://api.myspace.com/request_token"

    and we are able to get the oauth_token and oauth_secret_token.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    You suggested few points to us, but already we have done all those things like sorting oauth header before HMAC calculation and all.

    But while doing it programatically we are getting problem. we are using QHttp module of QT.

    please have a look at below code snippet..


    http->setHost("api.myspace.com");


    QHttpRequestHeader header("POST", "/request_token");

    header.setValue("Host","http://api.myspace.com");

    header.setContentType("application/x-www-form-urlencoded");


    header.setValue("Authorization","OAuth  oauth_nonce=12343212,oauth_timestamp=1241514332,oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=WN8oy0CwYjW3tVJEPXdQM7HH5RQ");

    http->request(header,array);

    but we are getting 400 Bad request in response header.

     can you please suggest where we are doing wrong!Wink

    are we  need to add any more fields in the http request header? please suggest us!

     

    Thanks in advance..

    Regards,

    Tieto

     

     

  • 05-10-2009 8:16 AM In reply to

    • Hyper
    • Not Ranked
    • Joined on 03-03-2009
    • Posts 6

    Re: MySpace as installed application

     Hyper is not my name, it is the first half of the name of my company, I posted this reply with my companies developer account (by mistake), since the application was registered in companies name, not my own. Name is Shaul :-) Sorry about that...

     

    I have one function that signs my requests, I call it before every post or get request... It sets following on every call after request_token call:

    oauth_consumer_key

    oauth_signature_method

    oauth_version

    oauth_token

    oauth_nonce

    oauth_timestamp

    oauth_signature

     But, on request_token it is different... since 2 pieces of data are gotten from request token, oauth_token and oauth_token_secret (oauth_token_secret is added when generating hash after you get it) so I don't set  oauth_token.

     Parameters seem fine to me, but from what I have seen, on POST you don't pass them in HTTP header, but in HTTP body. It seemes that you are passing them as header. You should pass it as header in GET requests. Could be wrong, though. 

     

    you do this:

    header.setValue("Authorization","OAuth  oauth_nonce=12343212,oauth_timestamp=1241514332,oauth_consumer_key=5ac627c078ed400cb6c30bc122a8d6fc,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=WN8oy0CwYjW3tVJEPXdQM7HH5RQ");

     

    while I do the same on GET request, but this one is POST, so I do (in libcurl code):

    curl_easy_setopt(hCurl, CURLOPT_POSTFIELDS, sArgList.c_str());

    where my sArgsList is:
    oauth_consumer_key={consumer key}&oauth_nonce={nonce}&oauth_signature={signature}=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1241968427&oauth_version=1.0

     I searched in my code (I reused some of the OAuth code from someone else's implementation of Facebook API), and could find no mention of  strins "Authorization" and "OAuth" when making calls. 

  • 05-10-2009 11:51 PM In reply to

    • Tieto
    • Top 200 Contributor
    • Joined on 04-03-2009
    • Posts 25

    Re: MySpace as installed application

     Hi Shaul,

    Sorry we don't know your name so that we refer you with ur id.

    From our side getting unauthorized key and unauthorized secret key is ok now.

    Actually we are doing small mistake in code itself. So now we are able to solve that.

    Now we are strucking at getting access_token. We feel we are doing some thing wrong in basestring formation. If we try to execute that command using curl command line utility we are getting "invalid signature error". I think myspace is also not providing any tool to cross check that signature.

     

    Please look at below command

     

    Base String:

     GET&http%3A%2F%2Fapi.myspace.com%2Faccess_token&oauth_consumer_key%3D2560ac4c8a824f46b40bff6d912b2763%26oauth_nonce%3DyKqLrJHZSAAnbtfa%26
    oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1242021537%26oauth_token%3DptcYOrlg4IN2RQiX9Mm2SyGmw5GrlqE%2FydaTxz4tdLjxFC3Hgu%2B7esu4sNW4D%2BTAo7ptqiOlslTg0azjx52wMw%3D%3D%26oauth_token_secret%3Da50ef60cc85643ac956365c89e4fc887%26oauth_version%3D1.0

     

    Key:

    54626aa1b4da4e39b467f62d1f2d83d0&a50ef60cc85643ac956365c89e4fc887

     

    final curl command

    curl --silent --header "Authorization: OAuth oauth_nonce=yKqLrJHZSAAnbtfa,oauth_timestamp=1242021537, oauth_consumer_key=2560ac4c8a824f46b40bff6d912b2763,oauth_token=ptcYOrlg4IN2RQiX9Mm2SyGmw5GrlqE%2FydaTxz4tdLjxFC3Hgu%2B7esu4sNW4D%2BTAo7ptqiOlslTg0azjx52wMw%3D%3D,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=TvrU641Hlb9Ugf/0fzyhCqZJ1vY%3D" "http://api.myspace.com/access_token"

     

    am we doing anything wrong while generating HMAC-SHA1 signature..

    Can you suggest us.

     

    Thanks in advance

    Regard,

    Tieto

     

    Filed under:
  • 05-11-2009 2:27 AM In reply to

    • Hyper
    • Not Ranked
    • Joined on 03-03-2009
    • Posts 6

    Re: MySpace as installed application

     I had a lot of problems with that too... This is my code:

        string sURL =  sPath; //full url, example: http://api.myspace.com/request_token

        sURL = urldecode(sURL.c_str());
        string enURL = urlencode(sURL.c_str(), sURL.size());
        string enArgList = urlencode(sArgList.c_str(), sArgList.size());
        string sBase = sMethod+"&"+enURL+"&"+enArgList;

        string sSecret = m_sSecret+"&";
        if (!m_sSessionSecret.empty()) //session secret we get from request_token             sSecret += m_sSessionSecret;

        char *sHMac = sha1_hmacBin64(sSecret.c_str(), sSecret.size(),sBase.c_str(), sBase.size());
        string strHMac = sHMac;
        free(sHMac);

        return strHMac;

  • 05-20-2009 2:47 AM In reply to

    • Tieto
    • Top 200 Contributor
    • Joined on 04-03-2009
    • Posts 25

    User Authorization Process Without Browser

    Hi,

     

    In OAuth can we manage "User Authorization Process"  without browser.  If there is any process for desktop application to authorize using

    URI+oauth_token+callback URI without browser help please help us. Is there anyway to authroze request_token using http methods. We are strucking here and we can find really very less faqs and material regarding desktop application.

     

    Thanks in advance.

     

    Regards,

    Tieto
  • 08-04-2009 1:04 AM In reply to

    Re: MySpace as installed application

    Hello, I am planing to write a desktop application to upload video and photo to myspace.

    I am new here and the document is so much that i can not find the end of threads.

    Can you show me the way. Oh,oo. First of all. can you tell me how to get my userID?

Page 1 of 1 (14 items)