Skip to content
Back

Missing scope after OAuth login

  • 0
  • Auth
  • Cloud
Yestix
16 Nov, 2025, 10:38

I want to get the current user with account.get after an OAuth login like Google but I always GET https://cloud.appwrite.io/v1/account 401 (Unauthorized) User (role: guests) missing scopes (["account"]). I can't find a way to fix it. Can someone help me? Many thanks! FYI: everything works when logging in with email and password

TL;DR
Developers are experiencing an issue with missing scopes ("account") after an OAuth login using Appwrite. They are encountering a 401 (Unauthorized) error. Ensure the client is initialized properly. Additionally, check the OAuth setup and console errors for further details. Verify that the correct scopes are provided during the OAuth process.
Devika
16 Nov, 2025, 10:45

Can you please share your OAuth setup? And more details of your console error?

Yestix
16 Nov, 2025, 10:50

This is the OAuth function: ```async OAuth() { try { return await account.createOAuth2Session({ provider: OAuthProvider.Google, success: ${process.env.NEXT_PUBLIC_WEBSITE_URL}/dashboard, failure: ${process.env.NEXT_PUBLIC_WEBSITE_URL}/ }); } catch (error:any) { throw(error)

TypeScript
    }
}```
Yestix
16 Nov, 2025, 10:50

The console error is nothing more than this: GET https://cloud.appwrite.io/v1/account 401 (Unauthorized) with AppwriteException: User (role: guests) missing scopes (["account"]).

Devika
16 Nov, 2025, 10:59

Do you have your client initialized? Like this: const client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT) .setSession("current");

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