Skip to content
Back

Nuxt: User (role: guests) missing scope (account)

  • 0
  • General
  • Auth
  • Web
David
16 Dec, 2024, 17:04

Hello everyone, I work with nuxt and I have the following issue:

TypeScript
Error checking user status: User (role: guests) missing scope (account)

  at Client.<anonymous> (node_modules\.pnpm\appwrite@16.0.2\node_modules\appwrite\src\client.ts:695:19)
  at Generator.next (<anonymous>)
  at fulfilled (node_modules\.pnpm\appwrite@16.0.2\node_modules\appwrite\node_modules\tslib\tslib.es6.js:73:58)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Here is the code that generate this error:

TypeScript
const checkUser = async () => {
  try {
    user.value = await account.get()
  } catch (error) {
    console.log('Error checking user status:', error)
  }
}

I have checked my active session in the cookies and I see: a_session_<userId>: <auth_token>

TL;DR
Developers using Nuxt experienced an error in their code related to a missing scope for the user role 'guests'. One user suggested creating a session on both the server and client when fetching data. The error originated from the code snippet provided causing the issue.
Kenny
16 Dec, 2024, 17:05

how are you authenticating?

David
16 Dec, 2024, 17:06

With:

TypeScript
account.createEmailPasswordSession(email, password)
Kenny
16 Dec, 2024, 17:08

Are you using SSR?

David
16 Dec, 2024, 17:08

Yes

Kenny
16 Dec, 2024, 17:10

You probably need a session created on the server and client depending on how you are fetching data

David
16 Dec, 2024, 17:10

How can I do that ?

Kenny
16 Dec, 2024, 17:15

I don't know much about Nuxt, but maybe this Next tutorial is applicable in some way?

David
16 Dec, 2024, 17:33

Ok thank you, I'll try to see that

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