Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xtc2016xtc opened this issue Aug 21, 2024 · 1 comment

Comments

@xtc2016xtc
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants