Am using next js
export async function createAdminClient() {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || "")
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT || "")
.setKey(process.env.NEXT_APPWRITE_KEY || "");
return {
get account() {
return new Account(client);
},
};
}
export async function logout(currentState: { message: string }) {
try {
const { account } = await createAdminClient();
await account.deleteSession("current");
cookies().delete("my-custom-session");
console.log("Logged out successfully");
redirect("/login");
} catch (error) {
console.log(error);
return {
message: "Invalid email or password",
};
}
}
error
{ code: 401, type: 'general_unauthorized_scope', response: { message: 'app.66fe880a001f23a26817@service.cloud.appwrite.io (role: applications) missing scope (account)', code: 401, type: 'general_unauthorized_scope', version: '1.6.0' } }
Recommended threads
- Messages stuck on processing
On the Messaging section of my Cloud console, I have 16 emails and push notifications that have been stuck on processing for months. They didn't get sent and wo...
- Please fix the error fast because all my...
Please fix the error fast because all my apps are closed so please fix this
- ☁ Read this if you're using appwrite clo...
If you're experiencing issues with Appwrite cloud, it's not your fault, the Appwrite team is working on solving the issue that affects some projects. # FAQ **-...