Windows live developer API - not showing user info when logged in RRS feed

  • Question

  • I have created my APP, I have included my CLIENT ID and REDIRECT URI in my code and added a link to login but when logged in, it doesn't show the users details?!

    here is my page:


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <title>Greeting the User Test page</title>
      <link rel="stylesheet" type="text/css" href="style.css" />
    <script src="https://js.live.net/v5.0/wl.js" type="text/javascript"></script>
      <script type="text/javascript">
        var APPLICATION_CLIENT_ID = "000000000000000",
        REDIRECT_URL = "http://www.trialsevolution.co.uk/app/home.html";
        WL.Event.subscribe("auth.login", onLogin);
          client_id: 000000004805DA23,
          redirect_uri: "http://www.trialsevolution.co.uk/app/home.html",
          response_type: "token"
          name: "signin",
          element: "signInButton"
        function greetUser(session) {
          var strGreeting = "welcome";
            path: "me",
            method: "GET"
          function (response) {
            if (!response.error) {
              strGreeting = "Hi, " + response.first_name + "!"
              document.getElementById("greeting").innerHTML = strGreeting;
        function setMeImage(token) {
          var imgHolder = document.getElementById("meimg"),
          imgTagString = "";
          if (token != null) {
            var url = "https://apis.live.net/v5.0/me/picture?oauth_token=" + escape(token);
            imgTagString = "<img src='" + url + "' />";
          imgHolder.innerHTML = imgTagString;
        function onLogin() {
          var session = WL.getSession();
          if (session){
      <p>Sign in to display a welcome greeting.</p>
      <div id="meimg"></div>
      <div id="greeting"></div>
      <div id="signInButton"></div>

    Sunday, August 21, 2011 1:51 PM

All replies

  • and link to my page is: here
    Sunday, August 21, 2011 1:53 PM
  • Hi,


    I'm sorry no one has responded to your post until now. When Looking at your source, I have found 3 problems. Once fixed, your page should work fine:


    1. Your client ID should be a string. JavaScript does not support HEX as numbers.

    2. instead of "oauth_token" use "access_token" according to the up to date bearer spec.

    3. Your onlogin and your callback for WL.api() calls sometimes manage to run before the body of your page is loaded. This causes your getElementById() calls to return null.


    Once these are fixed you should be good to go.



    Saturday, September 3, 2011 12:04 AM
  • Hi Matt,


    I am having the same problem.  Unfortunately, the problem is not resolved by your three suggestions.  The problem occurs much earlier.  I did some debugging and found that the problem is that the ONLOGIN function never gets invoked. 

    The WL.Event.subscribe("auth.login", onLogin); statement should have subscribed the client to the AUTH.LOGIN event, but for some reason it did not.  Or at least, it behaves as if the event was never subscribed to.

    How do we resolve this?



    Friday, October 14, 2011 8:48 PM