+ var logerr = document.getElementById("loginerror");
+ logerr.classList.add("hidden");
+ logerr.title = "";
+ if (!authData || !authData["state"]) {
+ // We have no oAuth state, try to fetch it and call ourselves again if it worked.
+ prepareLoginButton(function() {
+ if (authData && authData["state"]) {
+ startLogin();
+ }
+ else if (!userData) {
+ // Only warn if we didn't actually end up being logged in.
+ console.log("No OAuth state and fetching fails, client or server may be offline.");
+ logerr.classList.remove("hidden");
+ logerr.title = "Client or server may be offline.";
+ }
+ });
+ return;
+ }