
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
- SSR Image Previews
I am using the SSR guide (with SvelteKit) to use Appwrite on both the server and the client. I do this by also passing the cookie back to the client and creatin...
- Multiple Set-Cookie headers collapsed on...
I’m deploying a Next.js 15 app to Appwrite → Deploy → Sites. In app/api/auth/login/route.ts I try to set 3 cookies. Variant A (manual headers): const headers ...
- can't send emails
i explored the docs and it says Messaging.CreateEmail() but this function does not exist , i installed appwrite on next js env everything works fine except thi...
