Back

[SOLVED]User (role:guests) missing scope (account) trying to create new user with phone

  • 0
  • Users
SQUANT
21 Mar, 2023, 19:00

Hello guys i am trying to make a new user and session only with phone number but i am getting this error User (role:guests) missing scope (account) i am using this code

TypeScript
            try {
                // Create phone session
                const userId = ID.unique()    
                await account.createPhoneSession(userId,phone);
;               return userId;
            }
            catch (error) {
                console.log(error);
                return error

            }
        }```

in the appwrite docs it says that when the userId doesnt exists it creates a new user but it isnt working
TL;DR
The user is receiving an error message "User (role:guests) missing scope (account)" when trying to create a new user with a phone number. The issue is due to a function attempting to get the user before creating a phone session. The solution is to check the create phone session API call and ensure that it includes the parameter "phone". Additionally, it is suggested to check the network logs for API requests made.
Drake
21 Mar, 2023, 19:05

what makes you say this isn't working? Do you see a new user in your Appwrite project with the phone number used in the API request?

SQUANT
21 Mar, 2023, 19:06

No, i am just getting the error, no user is created

Drake
21 Mar, 2023, 19:06

would you please check the network logs to see the API requests made?

SQUANT
21 Mar, 2023, 19:09
Drake
21 Mar, 2023, 19:11

so the error you're seeing is for account.get().

Please look for the create phone session API call. it should say phone

SQUANT
21 Mar, 2023, 19:25

Thank you, it was a function trying to get the user before createPhoneSession

SQUANT
21 Mar, 2023, 20:06

[SOLVED]User (role:guests) missing scope (account) trying to create new user with phone

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