diff --git a/lib/client.js b/lib/client.js index ca621d0..117a281 100644 --- a/lib/client.js +++ b/lib/client.js @@ -199,6 +199,21 @@ class Client { throw new AppwriteException(text, response.status, "", text); } + if ( + json.code === 401 && + typeof json.message === "string" && + json.message.includes( + 'User (role: guests) missing scopes (["projects.read"])' + ) + ) { + throw new AppwriteException( + "Cannot access projects. Login is required use 'appwrite login' command", + json.code, + json.type, + text + ); + } + if (path !== '/account' && json.code === 401 && json.type === 'user_more_factors_required') { console.log(`${chalk.cyan.bold("ℹ Info")} ${chalk.cyan("Unusable account found, removing...")}`);