Libraries and Controls
Collapse the table of content
Expand the table of content

Libraries and Controls

Current information about Live Connect is now available in the Windows Live Developer Center. The information in the following sections is provided for legacy purposes only.

Windows Live Messenger Connect provides a variety of ways to integrate your applications. You can use Messenger Connect on your website and in desktop applications (with Windows Presentation Foundation and other technologies).

You can choose from several different types of integration, each covering a variety of scenarios. Your choices include:

  • Messenger Connect Representational State Transfer (REST) API service.
  • Messenger Connect JavaScript Library and controls.

The Messenger Connect REST API service exposes an endpoint that provides access to data such as the profiles, contacts, and activities of Windows Live users in REST semantics. You might use this approach for your website in scenarios where you do not want to load the JavaScript library files into the user's browser.

The typical usage pattern for the Messenger Connect REST API service is as follows:

  1. Request the user's consent to use his or her data that is stored with Windows Live. To do this, you send the user through the Messenger Connect consent user interface (UI). You then receive an access token and a refresh token with which to access the user's data. You can store the refresh token in your database for later use; it is valid for 12 months, whereas the access token is valid for only four hours.
    You can use the JavaScript library for signing users in to Windows Live and obtaining their consent. Alternatively, you can implement your own custom Open Authorization Web Resource Authorization Protocol (OAuth WRAP) handler for Messenger Connect. For details, see OAuth WRAP (Messenger Connect).
  2. Invoke the REST API for the resource that you are interested in, along with the access token that you obtained.
  3. Use the refresh token to obtain a new access token as needed.

You can implement this usage pattern on any platform. However, Microsoft has provided this functionality with the JavaScript library.

The Messenger Connect REST API enables applications to access user data while the user is not signed in (though the user must have previously provided consent). It can be called from back-end processes on the server side. This capability is particularly well suited for use with multiple-client interfaces, such as mobile devices and applications that perform out-of-band processing. For example, if a user performs an action on a website from his or her phone, the website can then call the REST API to publish the user's activity. Data from the REST API can be queried and sorted, and it is available in several formats: Atom, JavaScript Object Notation (JSON), JavaScript Object Notation with Padding (JSONP), RSS, and XML. For more information, see REST API Service and Resource Model (Messenger Connect).

The Messenger Connect JavaScript Library and UI controls operate on the client side in the user's browser session. They are intended for use in applications that access Windows Live data when users are signed in. Developers can use the JavaScript library and controls to quickly create rich, socially oriented experiences for their website users.

You can use the Messenger Connect UI controls to add a number of features to your website, from signing users in and displaying profile and presence data to hosting Windows Live Messenger conversations. The UI controls are simple to use and require little or no JavaScript code. You can rebuild all of the functionality of the controls by using the JavaScript library directly.

The typical usage pattern for the JavaScript library and controls is as follows:

  1. Include a reference to the loader script on the page that will host the library or controls. Hosted on the Microsoft edge network, the loader is a lightweight script that loads the appropriate components on your webpage in a manner similar to that employed by the Microsoft Ajax library and other public JavaScript libraries such as jQuery.
  2. Add the Application Control to your webpage. This control provides Windows Live with information such as your application's client ID, the path for your OAuth WRAP callback handler, and the scope that indicates the resources for which your application is requesting user consent.
    You must set up an OAuth WRAP callback handler to process the authentication responses from Windows Live. For Microsoft ASP.NET-based web applications, the Windows Live SDK includes an OAuth WRAP handler that you can use. This handler processes the response and sets the necessary cookies so that the JavaScript API can identify the authentication state of the user.
  3. Add the Sign In Control to your webpage. This control displays a button that prompts the user to sign in, and it wraps the user consent flow. Alternatively, you can use the signIn class in the JavaScript library. For more information, see Signing Users In (JavaScript Library).
  4. Add other functionality to the webpage by using the JavaScript library and controls.

When the webpage loads, the loader script scans it for elements that include the wl namespace and injects the necessary elements, event bindings, and data into the Document Object Model. As the JavaScript library runs in the user's browser, a cross-domain communication channel facilitates communication with Windows Live background services.

For more information, see Using the JavaScript Library and Controls for Messenger Connect.

© 2015 Microsoft