2

login.live.comを使用して、Webアプリにログインまたはログアウトしています。javascriptからWL.Login()を使用してログインしようとすると、成功します。しかし、WL.Logout()を使用してログアウトしようとすると、再度ログインするようにリダイレクトされます。私は探してみましたが、これを見つけまし。私の問題は、https: //login.live.com/oauth20_logout.srfを使用してライブIDからログアウトする方法です。

これが私のコードです

        WL.Event.subscribe("auth.login", onLogin);
        WL.Event.subscribe("auth.sessionChange", onSessionChange);
        WL.Event.subscribe("auth.logout", onLogout);
        WL.init({
            scope: ["wl.signin", "wl.basic", "wl.emails"],
            client_id: "****************",
        });

        function signUserIn() {
            WL.login();
        }
        document.write("<button onclick='signUserIn()'>Click here to sign in!</button>");

        function onLogin(session) {
            var session = WL.getSession();
            if (session.error) {
                document.getElementById('<%= LabelStatusLogin.ClientID %>').innerHTML =
                    "Error signing in: " + session.error;
            }
            else {
                document.getElementById('<%= LabelStatusLogin.ClientID %>').innerHTML =
                    "Signed in.";
            }
        }
        function onSessionChange() {
            var session = WL.getSession();
            if (session) {
                document.getElementById('<%= LabelStatusLogin.ClientID %>').innerHTML =
                    "Session changed.";
            }
            else {
                document.getElementById('<%= LabelStatusLogin.ClientID %>').innerHTML =
                    "Signed out or session error.";
            }
        }

        function onLogout() {
            window.location = "https://login.live.com/oauth20_logout.srf?client_id=*************&display=page&locale=en&redirect_uri=http%3A%2F%2Fexample.com%3A8182%2F&response_type=token&scope=wl.signin wl.basic wl.emails&state=redirect_type%3Dauth%26display%3Dpage%26request_ts%3D1354173175356%26response_method%3Durl%26secure_cookie%3Dfalse";
        }

        function signUserOut() {
            WL.logout();
        }
        document.write("<button onclick='signUserOut()'>Click here to sign out!</button>");
4

0 に答える 0