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
- Type 'Theme' does not satisfy the constr...
Type 'Theme' does not satisfy the constraint 'Row'. Type 'Theme' is missing the following properties from type 'Row': $id, $sequence, $tableId, $databaseId, a...
- Dev Keys not working
looks like dev key are broken they simply don't work i suggest remove them until you have them working otherwise they confuse devs took me few minutes trying ...
- Stuck migrating from supabase
Hello, I'm getting a 500 (Internal Server Error) when migrating from Supabase using the cloud console migration tool. Validation says error: "Couldn’t load reso...