javascriptapilivewindows-live

Windows Live API connexion issue


I'm trying to get a user's contact through Windows Live js API. I've read the official documentation, but I'm having trouble performing a simple connexion.

Here is what I've made :

WL.init({
    client_id: 'myclientId',
    redirect_uri: 'http://www.salezeotest.lan',
});

function signInUser() {

            WL.login({
                scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails"]
            }).then(
                function(response) 
                {
                    console.log("logedin");
                },
                function(responseFailed) 
                {
                    console.debug(responseFailed);
                    console.log('error');
                }
            );
        }

The 'signInUser' function is trigerred after a button click. What's happening is that when I click on it, I get the live popup to enter my credentials, and allow my application to access the stuff I put in the 'scope'.

Then, I click the 'yes' button to allow access, and I get redirected to my redirectURI inside a popup (I can see the access token in the url). But nothing happens then, the console doesn't log anything untill I close the popup, then I get this message :

[WL]WL.login: The popup is closed without receiving consent.

I'm testing this locally, and I've already tweaked my host file.

Any thoughts?!


Solution

  • Found my problem, didn't pay attention that my redirectURI wasn't the same as the page that requested loggin.