diff --git a/dist/bundle.js b/dist/bundle.js index 8f2aeac..520378f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -798,18 +798,18 @@ Lbryio.authenticate = function () { Lbryio.authenticationPromise = new Promise(function (resolve, reject) { Lbryio.getAuthToken().then(function (token) { if (!token || token.length > 60) { - return false; + return [false]; } // check that token works - return Lbryio.getCurrentUser().then(function () { - return true; + return Lbryio.getCurrentUser().then(function (user) { + return user; }).catch(function () { return false; }); - }).then(function (isTokenValid) { - if (isTokenValid) { - return reject; + }).then(function (user) { + if (user) { + return user; } return _lbryRedux.Lbry.status().then(function (status) { @@ -827,7 +827,12 @@ Lbryio.authenticate = function () { return reject(); }); - }).then(Lbryio.getCurrentUser).then(resolve, reject); + }).then(function (user) { + if (!user) { + return Lbryio.getCurrentUser(); + } + return user; + }).then(resolve, reject); }); } diff --git a/src/lbryio.js b/src/lbryio.js index 516a37b..5ab9d74 100644 --- a/src/lbryio.js +++ b/src/lbryio.js @@ -110,17 +110,17 @@ Lbryio.authenticate = () => { Lbryio.getAuthToken() .then(token => { if (!token || token.length > 60) { - return false; + return [false]; } // check that token works return Lbryio.getCurrentUser() - .then(() => true) + .then(user => user) .catch(() => false); }) - .then(isTokenValid => { - if (isTokenValid) { - return reject; + .then(user => { + if (user) { + return user; } return Lbry.status().then(status => { @@ -137,7 +137,12 @@ Lbryio.authenticate = () => { return reject(); }); }) - .then(Lbryio.getCurrentUser) + .then(user => { + if (!user) { + return Lbryio.getCurrentUser(); + } + return user; + }) .then(resolve, reject); }); }