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
- CORS preflight returns 500 on Dart funct...
Hey everyone 👋 I’m running a Dart cloud function, Every time I respond to a preflight (OPTIONS) request, I get a 500 internal error, and the logs show: ```NoSu...
- Auto Updating Backend & Auth via Appwrit...
<@870607367597850624> Hey everyone 👋 I wanted to ask to ask for a friend, he’s asking if Appwrite be used in a similar way to Supabase when integrated with AI ...
- execution failed
When executing an appwrite function, I'm getting a 500 error, but I don't see it in executions. This issue appeared today. Here's the appwrite function ID: 68b4...