locked
Problem with "Streamlining account registration" RRS feed

  • Question

  • Hi all,

    I have a big problem with the development of the Streamlining account registration. My problem is that I can't prevent the signIn function auto start.

    My Code is:

        WL.init({ client_id: '00000000XXXXXXXX', redirect_uri: "http://mydomain.com/test.php" });
    WL.login(
        { "scope": "wl.basic wl.birthday wl.emails" },
        function (response) {
            if (response.status == "connected") {
                registerUser();
            }
            else {
                log("Could not connect, status = " + response.status);
            }
        });
    
    function registerUser() {
        WL.api("/me", "GET",
            function (response) {
                if (!response.error) {
                    fillRegistrationForm(response);
                }
                else {
                    log("API call failed: " + JSON.stringify(response.error).replace(/,/g, "\n"));
                }
            });
    }
    
    function fillRegistrationForm(user) {
        // NOTE: Assign these values to your form elements to streamline registration.
        log("First name: " + user.first_name);
        log("Last name: " + user.last_name);
        log("Preferred email: " + user.emails.preferred);
        log("Gender: " + user.gender);
        log("Birthday: " + user.birth_month + "/" + user.birth_day + "/" + user.birth_year);
    }
                        
    function log(message) {
        console.log(message);
    }
    


    If i create a function with inside the WL.login(...) and i bind this function on the link click, the signIn popup appears but when it close i don't receive the user data if not only on the next reload page.

    My goal is to allow user to register into my website doing a MSN signIn.

     

    Can anybody help me?

     

    Regards.

    Tuesday, September 13, 2011 9:11 AM

Answers

All replies

  • I'm not sure what flow you're trying to achieve -- the user has to sign in and grant their consent in order to connect to your application using Messenger Connect, so why are you trying to close the signIn popup?
    Tuesday, September 13, 2011 10:32 PM
    Moderator
  • sorry for my english....

    If i create a function with inside the WL.login(...) and i bind this function on the link click, the signIn popup appears, the user grant their consent and the popup close itselft. On the firebug I receive this message: [WL]WL.login: The popup is closed without receiving consent. but I had click to consent!!!

    I'm explain better?


    Certainly i wrong something but i don't understand where...

    PS: I have problem also with example downloaded from Download section

    • Edited by Ewhere Wednesday, September 14, 2011 2:34 PM
    Wednesday, September 14, 2011 2:30 PM
  • Have you tried to do the user registartion onLoginComplete like this:-

          WL.Event.subscribe("auth.login", onLoginComplete);
          WL.Event.subscribe("wl.log", onAPIError);

          function onLoginComplete() {
             var session = WL.getSession();
             if (session.error) {
                 signedOutUser();
             }
             else {
                registerUser();
             }
          }

    Thursday, September 15, 2011 3:35 PM
  • Hi EWhere,

      What does your callback page do (http://mydomain.com/test.php)? We expect your callback page be a page that simply load the wl.js 

    e.g.  <script src="//js.live.net/v5.0/wl.js" type="text/javascript" ></script>

    Lin

    Thursday, September 15, 2011 3:56 PM
    Moderator
  • can you please point out where this is documented? the oauth docs are a complete nightmare of aspx madness. I had to google for the error and fortunately found this page.
    Monday, October 8, 2012 6:33 AM
  • very Simple, WL.getLoginStatus is for this situation.

    WL.getLoginStatus( function(response) { if(response.session == null) { singUserIn(); } });

    function singUserIn() { WL.login({ scope: scope }); }


    Friday, July 5, 2013 8:22 AM