Closing OAuth 2.0 popup window after redirect

I think popup you can close by

parent.close();

And to refresh main window I used this trick:

$(function() {
    var win;
    var checkConnect;
    var $connect = $("#some_button");
    var oAuthURL = "http://example.com/account/_oauth?redirect_url=" + redirect_url;
    $connect.click(function() {
        win = window.open(oAuthURL, 'SomeAuthentication', 'width=972,height=660,modal=yes,alwaysRaised=yes');
    });

    checkConnect = setInterval(function() {
        if (!win || !win.closed) return;
        clearInterval(checkConnect);
        window.location.reload();
    }, 100);
});

Opener ( main window ) just checks every time if the popup still live and if win.closed returns true – the main window reloads

Hope it will help somebody

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)