Although accessing data using the Live Framework is as simple as making REST API calls, one thing that might take you more time to figure out is authentication. The Live Framework relies on the Delegated Authentication mechanism to authenticate the incoming request and check for authorization to access the data being requested. This is done by providing a ticket (Delegation Token) in an AppDelegationToken HTTP header. Delegated authentication allows a Windows Live ID user to grant consent to a 3rd-party web application to access data on his/her behalf. Last December, we posted a great article on how to implement delegated authentication for your website using .NET. But we want to make it even easier for you to make your first API call to the Live Framework.

In this post, we give you a quick way to generate a temporary delegation token and show you how to use it to connect with the Live Framework cloud endpoint (https://user-ctp.windows.net/). Note that this method of generating a token is only for testing purposes. Since the goal of this exercise is to make it easy for you to make your first API call to the Live Framework, we do not cache the token on the server.

1. Go to the token generation utility at http://token.mslivelabs.com.

2. Click the link to grant access to your data.

3. Login with your Windows Live ID.

4. Click “Allow Access”.

5. Use the generated HTTP header to make an HTTP GET request on https://user-ctp.windows.net.

FYI: here's an example header, requesting data to be returned in the ATOMPub format:

  Accept: application/atom+xml
  Content-Type: application/atom+xml
  AppDelegationToken: "<insert a valid token here>"
  Host: user-ctp.windows.net
  Connection: Keep-Alive

To learn how to use this header to make requests for resources, see Interacting with the Live Operating Environment by Using HTTP.

Happy coding!

 

--Live Framework Team