let win = window.open('oauthURL', 'oauth', 'width=800,height=600,status=0,toolbar=0');
let timer = setInterval(function () {
try {
let path = win.location.pathname.split('/')
if (path[1] === 'oauth-success') {
clearInterval(timer)
win.close()
// SUCCESS CALLBACK
}
if (win.closed) {
clearInterval(timer)
}
return false;
} catch (e) {
// ERR CALLBACK
}
}, 1000);