MySpaceID: Another way to login to a website without registration

28 May 2009 Published in Blog

What is MySpace?

If you have a profile of “Developer” on MySpace then you will be able to create applications. These can be of 2 types: internal or external. The first are developed to introduce into our profile iframes with our applications, the second type (which we are interested in remaining article) allow us to create ‘Lives App’ or  external applications of MySpace in order to extract information from the API and use it on our websites. This tool is known as MySpaceID.

Implementation:

The first thing we must do is create an application on our MySpace account developers (must have prior permission to develop, this procedure takes about 48hs).

When we have access, go http://developer.myspace.com/community/ -> MyApps -> Create New MySpace Application and choose type.

In ‘external callback’ Enter the URL of our site and remember to save OAuth Consumer Key and OAuth Consumer Secret.

Once created the application must publish, we should see a sign: Status changed to [Live], if this happens we are able to use our site.

 

Now we move to the implementation on our site, which is the most complicated part. The key are to use the access Oauth protocol, which consists of 3 steps:

  1. Our site ask for the access token (request_token) MySpace returns the password (token)
  2. Generates the key “signature”. This signature will expire in a period of time defined by MS (about 5 minutes). With it you can have the link to put on your site. You also set a callback which will be redirected after logging.
  3. We made the calls to the MySpace API. Just simply modify the line $user=’http://api.myspace.com/v1/user’; of the example and call up the URL of the form described in http://developer.myspace.com/community/RestfulAPIs/resources.aspx. Keep in mind that we must generate a signature key for each callback URL.

Conclusions (at time of writing this article):

  • MySpace is a very new tool, which is constantly being modified, for example while doing a project using this tool, we had to encode it again because MySpace had amended its framework with which build this applications. This can play against in the development of MySpace app, which is still very unstable.
  • Other against: is not even supported the invitation to contacts on MySpace from other sites (you can do it with facebook now)

Class.MySpaceID.php

Builder:

MySpace objMS $ = new ($ oauth_consumer, $ _oauth_secret)

Where the parameters are the data of our application of MySpace.

Methods:

getLinkToUser function ($ callback) / / creates the link for the user to log in callback is the address where we introduced q then log back on MySpace.

** After user log, can be used:

getMySpaceID function () / / returns the ID of the user logged
getMySpaceProfile function ($ id_myspace) / / returns the id of the user profile from MySpace
getMySpaceFriends function ($ id_myspace) / / returns the list of friends of the MySpace user ID

Serfe info(at)serfe.com https://www.serfe.com/images/serfe_logo_text.png https://www.serfe.com/images/serfe_logo_text.png FALUCHO 2032, S3016LDB, SANTO TOME, SANTA FE, ARGENTINA 1-305-5375397
Cookies & Privacy: 
This website uses cookies to ensure you get the best experience on our website.


Privacy Policy