Back

Error creating user: [Error: AppwriteException: User (role: guests) missing scope (account)]

  • 1
  • React Native
  • Auth
Creale
5 Aug, 2024, 15:04

Currently having a problem. I am stuck here, I do not know how to progress my capstone with this error. Please help me guys

TL;DR
Developers are facing an issue creating user accounts due to a permission error: "User (role: guests) missing scope (account)." This error is hindering the development of an emergency app for school. To resolve this, they should adjust their permission settings to allow guest users to create accounts.
Creale
5 Aug, 2024, 15:05

How do I resolve the issue and allow the guest users to create accounts?

Creale
5 Aug, 2024, 15:08
Creale
5 Aug, 2024, 15:09
Creale
5 Aug, 2024, 15:12

The main context of my system is, an emergency app that will allow students to report emergencies in our school. Students the primary user they are has no accounts, only the emergency officers will have an account. If Student wants to be an emergency officer, he/she then will register an account and if you're successfully created an account, emergency officer will receive notifications of the emergency

Creale
5 Aug, 2024, 15:13

The problem right now is, I cannot create an account because it says this error Error creating user: [Error: AppwriteException: User (role: guests) missing scope (account)]

Creale
5 Aug, 2024, 15:20

the sdk for react native

IMxSuhasTheBoy
5 Aug, 2024, 15:20

Client side or server side sdk ? for performing create operation?

Creale
5 Aug, 2024, 15:20

client side

IMxSuhasTheBoy
5 Aug, 2024, 15:21

probably figure out what the role & permissions setting options are needed for your use case in client side operation

IMxSuhasTheBoy
5 Aug, 2024, 15:23

im doing my CRUD operation on user through server side node-appwrite sdk, im too on figuring out to do things in right way my app

Creale
5 Aug, 2024, 15:23

alright, thank you for your time and answer good sir

D5
5 Aug, 2024, 15:24

Did you managed to solve it?

D5
5 Aug, 2024, 15:24

What are your permissions set to?

D5
5 Aug, 2024, 15:25

Also, are you logged in?

Creale
5 Aug, 2024, 15:26

not yet, I am still very new to this, sorry

Creale
5 Aug, 2024, 15:26

I made my permission to set all user and guest has the ability to crud, just for testing. But to no avail, it still not working apparently

Creale
5 Aug, 2024, 15:31

my sign-up.jsx

TypeScript
import { Alert, View, Text, SafeAreaView, ScrollView } from 'react-native';
import { router } from 'expo-router';
import { createUser } from '../../lib/appwrite';

import FormField from '../../components/FormField';
import CustomButton from '../../components/CustomButton';

const SignUp = () => {
  const [form, setForm] = useState({
    name: '',
    email: '',
    password: ''
  });
  const [isSubmitting, setisSubmitting] = useState(false);

  const submit = async () => {
    if (!form.name || !form.email || !form.password) {
      Alert.alert('Error', 'Please fill in all the fields');
      return;
    }
    setisSubmitting(true);

    try {
      const result = await createUser(form.email, form.password, form.name);
      //set it to global state ...

      console.log('User created:', result);
      router.replace('/menu');
    } catch (error) {
      Alert.alert('Error', error.message);
    } finally {
      setisSubmitting(false);
    }
  }

  return (
    <SafeAreaView className="bg-white h-full">
      <ScrollView>

    //wont show the code here, its just the buttons and text fields

export default SignUp;
Creale
5 Aug, 2024, 15:33

my sign-in

TypeScript
import { Alert, View, Text, SafeAreaView, ScrollView } from 'react-native';
import { router } from 'expo-router';
import { signIn } from '../../lib/appwrite';

import FormField from '../../components/FormField';
import CustomButton from '../../components/CustomButton';

const SignIn = () => {
  const [form, setform] = useState({
    email: '',
    password: ''
  });
  const [isSubmitting, setisSubmitting] = useState(false);

  const submit = async () => {
    if (!form.email || !form.password) {
      Alert.alert('Error', 'Please fill in all the fields');
      return;
    }

    setisSubmitting(true);

    try {
      await signIn(form.email, form.password);
      router.replace('/SERTemergency');
    } catch (error) {
      Alert.alert('Error', error.message);
    } finally {
      setisSubmitting(false);
    }
  }

  return (
    <SafeAreaView className="bg-white h-full">
      <ScrollView>
        <View className="w-full justify-center min-h-[85vh] px-4 my-6">
          <Text className="text-2xl text-black text-semibold mt-10 font-psemibold">Sign In!</Text>
           //wont show the code here, its just the buttons and text fields
export default SignIn;
Creale
5 Aug, 2024, 15:50

I hope someone can help me

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