Back

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

  • 0
  • Auth
  • Web
Kukreja
5 Aug, 2024, 14:30

I'm encountering a problem with the Account.get() method in my React project. When I try to get the currently logged-in user, I get a 401 error: "User (role: guests) missing scope (account)."

I tried ensuring the code runs client-side, but I'm not sure if my implementation is correct. Here is my current setup:

TL;DR
Issue: Getting "User (role: guests) missing scope (account)" error when using the Account.get() method in React project. Possible Solutions: 1. Check if the session is being set correctly. Verify localstorage or cookies. 2. Use `'use client'` at the top to force it to be client side. 3. Ensure you are allowing third-party cookies in the browser settings, especially if using OAuth2. Development Tip: When encountering authentication errors, verify session management and client-side implementation for smoother user experience.
Kenny
5 Aug, 2024, 14:32

put 'use client' at the top to force it to be client side?

Kenny
5 Aug, 2024, 14:33

after authenticating when you call account.get() you're getting that error? Have you checked to make sure the session is being set? Check localstorage or cookies.

Steven
5 Aug, 2024, 14:37

Are you using oauth2? Another problem could be that the browser is blocking 3rd party cookies. You can try looking into how to allow 3rd party cookies in your browser settings

Kukreja
5 Aug, 2024, 14:50

Yes, I am using OAuth2 and I also allow third-party cookies on my site.

Kukreja
5 Aug, 2024, 14:57

Actually, everything was working fine today, but suddenly an error came from my database side. To check it, I logged out of my authentication, and after that, I am unable to log in to the site.

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