Back

General Unauthorized Scope Error

  • 0
  • Cloud
LazyNinja
19 Jun, 2024, 11:56

When trying to login through OAuth2 google, the following error occurs. { "message": "User (role: guests) missing scope (account)", "code": 401, "type": "general_unauthorized_scope", "version": "1.5.7" } I cannot login through google. The following is my code snippet for logiging in with google.

export const handleGoogleLogin = async (e) => { e.preventDefault() try{ const session = await account.getSession('current') if(session) { await account.deleteSession('current') } await account.createOAuth2Session( OAuthProvider.Google, "http://localhost:3000", "http://localhost:3000/failure", ) } catch(err) { console.log(err) alert(err) } }

TL;DR
Error message: User with role 'guests' missing scope 'account' when trying to log in with Google OAuth2. Code snippet provided. Solution: Make sure the necessary scope 'account' is included in your OAuth2 session creation for Google login.
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