adrianhajdin / banking

Horizon is a modern banking platform for everyone.
https://banking-jet.vercel.app
MIT License
2.09k stars 645 forks source link

I follow the video teaching I've got all the permissions. There's no problem logging in, registering #50

Open xtc2016xtc opened 2 months ago

xtc2016xtc commented 2 months ago

export async function getLoggedInUser() { try { const { account } = await createSessionClient(); const user = await account.get(); return parseStringify(user);

} catch (error) { console.error("Error fetching logged-in user:", error); return null; } } Error fetching logged-in user: AppwriteException [Error]: User (role: guests) missing scope (account) at Client.call (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/client.js:206:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Account.get (webpack-internal:///(rsc)/./node_modules/node-appwrite/lib/services/account.js:31:16) at async getLoggedInUser (webpack-internal:///(rsc)/./lib/actions/user.actions.ts:57:22) at async Home (webpack-internal:///(rsc)/./app/(root)/page.tsx:45:22) { code: 401, type: 'general_unauthorized_scope', response: { message: 'User (role: guests) missing scope (account)', code: 401, type: 'general_unauthorized_scope', version: '1.5.10' } }

nivindulakshitha commented 2 months ago

The error 401 general_unauthorized_scope indicates that the current user or the API key lacks the necessary permissions or scopes to access the resource you're trying to retrieve. In the context of Appwrite, this typically means that the user is either not authenticated or the session/client does not have the required permissions. See their docs here.