Back

Possible unhandled promise rejection (id: 0): Error: AppwriteException: User (role: guests) missing

  • 0
  • React Native
Lucem
20 May, 2024, 08:28

Hello everyone, I need some help. I am building a mobile application with expo react native but I am getting this error: "Possible unhandled promise rejection (id: 0): Error: AppwriteException: User (role: guests) missing scope"

here is my code const client = new Client();

client .setEndpoint('') .setProject('');

const account = new Account(client);

export async function verifyNumber(userId, phoneNumber) { try {

TypeScript
        const response = await account.createPhoneToken(
            userId, // userId
            phoneNumber // phone
        );
        console.log(response.userId);
        AsyncStorage.setItem('userId', response.userId);
        return response.userId;

} catch (error) {
    throw new Error(error);
}

}

export async function checkOtp(userId, secret){ console.log(userId: ${userId}, secret: ${Number(secret)}); // Log the inputs try { const response = await account.updatePhoneSession( userId, // userId secret // secret ); console.log(response);

TypeScript
} catch (error) {
    console.error(error.message);
    throw new Error(error)
}

}

// Sign Out Appwrite export async function signOutAppWrite() { try { const session = await account.deleteSession("current");

TypeScript
  return session;
} catch (error) {
  throw new Error(error);
}

} I don't know how to solve this issue, please could i get some help

TL;DR
A developer building a mobile app with Expo React Native is facing the error: "Possible unhandled promise rejection (id: 0): Error: AppwriteException: User (role: guests) missing scope." The issue might be related to missing user permissions (role: guests). To potentially fix this, make sure your appwrite instance has the appropriate user permissions. Check if the role 'guests' has the necessary scopes required by your code. You may need to adjust your account settings in Appwrite to grant the required permissions. Additionally, review your code to ensure correct usage of Appwrite methods like createPhoneToken, updatePhone
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