Skip to content
Back

Can not get the logged in user data in NextJS app

  • 0
  • Web
Zaki
6 Nov, 2025, 11:47

I'm trying to get the user data after i log in with otp but it get this error :

AppwriteException: User (role: guests) missing scopes (["account"]) at Generator.next (<anonymous>) { code: 401, type: 'general_unauthorized_scope', response: '{"message":"User (role: guests) missing scopes (["account"])","code":401,"type":"general_unauthorized_scope","version":"1.8.0"}' } Failed to get authenticated user

the error comes from the getAuthunticatedUser function, I also attached 3 images shows my two server actions and the sdk setup repo for full code: https://github.com/MohamedZakidev/store-it

TL;DR
Unable to retrieve logged-in user data in NextJS app due to missing scope error. Error occurs during getAuthenticatedUser function. Refer to provided GitHub repository for full 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