Skip to content
Back

[AppwriteException: User (role: guests) missing scope (account)]

  • 0
  • Auth
  • Web
Kk
11 Nov, 2024, 16:52

I have a nextjs project. I am using middleware to develop role based access to routes. I am using below code in middleware.ts file for geting session

const session = await account.getSession('current');

Issues:

[AppwriteException: User (role: guests) missing scope (account)] { name: 'AppwriteException', code: 401, type: 'general_unauthorized_scope', response: { message: 'User (role: guests) missing scope (account)', code: 401, type: 'general_unauthorized_scope', version: '1.6.0' }

TL;DR
Developers are encountering an AppwriteException related to a missing scope (account) for a user with the role of guests. This error is occurring in a nextjs project while using middleware for role-based access to routes. To fix this issue, the developers need to ensure that the user role (guests) has the necessary scope (account) set up in the middleware configuration.
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