I am getting this error even after the user is logged In
https://cloud.appwrite.io/v1/account 401 (Unauthorized)
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
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)
const result = await account.createEmailPasswordSession(
email, // email
password // password
);
return result;
};```
This is what i am using to log in the user
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Rate Limit of project
AppwriteException: Rate limit for the current endpoint has been exceeded. Please try again after some time. So , how much time I have to wait and why does it h...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...