Back

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

  • 1
  • Auth
  • Web
dantedmc
22 Mar, 2024, 21:43

This is the error I am facing Backend :: getCurrentUser :: error AppwriteException: User (role: guests) missing scope (account) at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:850:17) at Generator.next (<anonymous>) at fulfilled (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:488:24)

This is my code import {Client, Account, ID, Databases } from 'appwrite'; import conf from '../conf/conf';

export class AuthService{ client = new Client(); account; databases

TypeScript
constructor (){
    this.client
        .setEndpoint(conf.appwriteUrl)
        .setProject(conf.appwriteProjectId)

        this.account = new Account(this.client)
        this.databases = new Databases(this.client);
}

async createAccount ({ email, password, name, confirm_password}) {
    try {
        const id = ID.unique()            
        const userAccount = await this.account.create(id, email, password, name, confirm_password )

        if (userAccount) {
            return userAccount
        } else {
            return false
        }

    } catch (error) {
        console.log("Backend :: createAccount :: error", error)
        throw error          
    }
}

please help

TL;DR
Developers using ReactJS are encountering an error 'AppwriteException: User (role: guests) missing scope (account)' when using an Appwrite account creation function. Check if you are using a SSR framework. The issue seems to be with the account's missing scope. Make sure that the user has the necessary scope for the account.
D5
22 Mar, 2024, 21:45

Are you using some kind of SSR framework?

dantedmc
22 Mar, 2024, 21:49

I am using reactJS

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