.then(function (cred) { if (is_oauth) { return provider.oAuthRefreshAccessToken(cred) .then(function (new_cred) { return utils.saveCredentials(new_cred) .then(function () { return FileFog.client(Name, new_cred,FilefogOptions) }) }) } else { return FileFog.client(Name, cred,FilefogOptions); } })
.then(function () { return FileFog.client(Name, new_cred,FilefogOptions) })