Back

User (role: guests) missing scope (account)

  • 0
  • Auth
  • Web
  • Cloud
Himanshu
17 Aug, 2024, 05:44

trying to use user preferences

TypeScript
AppwriteException: User (role: guests) missing scope (account)
    at Client.eval (webpack-internal:///(rsc)/./node_modules/appwrite/dist/esm/sdk.js:455:27)
    at Generator.next (<anonymous>)
    at fulfilled (webpack-internal:///(rsc)/./node_modules/appwrite/dist/esm/sdk.js:46:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 401,
  type: 'general_unauthorized_scope',
  response: {
    message: 'User (role: guests) missing scope (account)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: '1.5.10'
  }
}```

```ts
async function GetCurrentChat() {
  try {
    const res = await AppwriteUser.getPrefs();
    return res?.['x0-chatID'];
  } catch (error: any) {
    console.log(error);
    return false;
  }
}```
TL;DR
Developers are experiencing a "User (role: guests) missing scope (account)" error when trying to access user preferences using OAuth. The issue may be related to 3rd party cookies. For local development, enable 3rd party cookies in browser settings. In production, use custom domains. The code appears to be consistent, and authenticated users can access the database.
Himanshu
17 Aug, 2024, 05:47

the user is authenticated

Himanshu
17 Aug, 2024, 05:47

and it can acces database also it is working fine their

Himanshu
17 Aug, 2024, 05:48

also the current logged in user details were returned

Himanshu
17 Aug, 2024, 05:50

am using OAuth and facing this

Himanshu
17 Aug, 2024, 05:50

the one where i used email otp auth that works fine

Himanshu
17 Aug, 2024, 05:51

every single code is same dude then why this even happens

Steven
17 Aug, 2024, 05:53

It's probably a 3rd party cookie problem.

For local development, maybe you can change your browser settings to enable 3rd party cookies.

In production, you'll need to use custom domains

Himanshu
17 Aug, 2024, 05:54

3rd party cookies are allowed

Himanshu
17 Aug, 2024, 05:54

in production am using custom domains

Himanshu
17 Aug, 2024, 05:54

already

Himanshu
17 Aug, 2024, 05:54

uff

Steven
17 Aug, 2024, 05:57

Look at the network request in the network logs. Do you see the cookie included in the request?

Himanshu
17 Aug, 2024, 05:59
Himanshu
17 Aug, 2024, 06:00

this is when the page is reloaded

Himanshu
17 Aug, 2024, 06:00

but

Himanshu
17 Aug, 2024, 06:00

this is my code

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more