
I am getting this error even after the user is logged In
https://cloud.appwrite.io/v1/account 401 (Unauthorized)
TypeScript
try {
const userData = await account.get();
setUser(userData);
console.log("USERDATAAAAAAAAAAA", userData);
if (userData) {
router.replace("/");
window.location.reload();
}
setLoading(false);
} catch (error) {
console.log(error);
setLoading(false);
}
};
The above function was to check and fetch userData (User Is already signed In till here)
Below is my appwriteConfgi code
TypeScript
const client = new sdk.Client()
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject("ProjectId")
.setKey(
"apiKey"
);
export const account = new sdk.Account(client);
export const users = new sdk.Users(client);
export const storage = new sdk.Storage(client);
export const databases = new sdk.Databases(client);
(Have removed APi key and projectId as of now for posting)
TL;DR
Developers are encountering an AppwriteException: User (role: guests) missing scope (account) error despite successful user login. The issue persists even after the user is logged in. The error message appears as a 401 (Unauthorized) on the Appwrite Cloud platform. The checkUserStatus function is successfully fetching user data, indicating a successful sign-in, and then the user is directed to the main page. However, the error occurs during this process.
The appwriteConfig code snippet is provided for context, with API key and Project ID removed for the post. The developers are using the provided code for user authentication and fetching user data
TypeScript
const result = await account.createEmailPasswordSession(
email, // email
password // password
);
return result;
};```
This is what i am using to log in the user
Recommended threads
- Looking for Partner
I'm looking for partner for long-term collaborating. Of course, I'll pay for you. If you are interested, Please DM me.
- Hola equipo de soporte,
Hola equipo de soporte, Estoy desarrollando una Function en Appwrite Cloud con Node.js 22 y el siguiente package.json: { "name": "upload-whitelist", "type"...
- Looking for Partner
I'm looking for partner for long-term collaborating. Of course, I'll pay for you. If you are interested, Please DM me.
