Detecting user already logged in when using SSO

So, have Discourse have a </body> script that goes like this:

if (!Discourse.User.currentProp('username') {
    $.ajax(....., {
        ....
        dataType: "jsonp",
        success: function(xhr) {
            if (xhr.responseJSON.have_account) {
                window.location = "/session/sso";
            }
        }
    });
}

It fails open - if the main site is down, the user can continue to browse as an anon on Discourse.