Back

Database creation error

  • 0
  • Databases
  • Flutter
dammy
25 Jun, 2023, 09:17

flutter: Server Error: {message: User (role: guests) missing scope (account), code: 401, type: general_unauthorized_scope, version: 1.3.7}

TL;DR
The user is experiencing an error while trying to create a database. They are unsure why it is not working and have attempted to set collection permissions and use session. They have also shared a code snippet. The error message suggests that the user is trying to access an account without being logged in, resulting in a 401 unauthorized error. Solution: The user should ensure that they are logged in before trying to access the account.
Hassanmrwt
25 Jun, 2023, 09:19

Share code snippet please

Hassanmrwt
25 Jun, 2023, 09:20

You might trying to access Account without login which results in this error

dammy
25 Jun, 2023, 09:23

appWriteLogicExtender.databases.createDocument( databaseId: "idDB", collectionId: "idCol", documentId: ID.unique(), // permissions: ['"user":userID'], data: { "userFullName": nameController.text, "accountCreationDate": dateTime.timeZoneName, "userStatus": "normalUser", "userMail": emailController.text, "phoneNumber": phoneNumberController.text, "userID": profile.$id, });

dammy
25 Jun, 2023, 09:24

must I have session before that?

dammy
25 Jun, 2023, 09:24

cause I dont want the document to be created always at login

dammy
25 Jun, 2023, 09:25

I set permission to any

Hassanmrwt
25 Jun, 2023, 09:27

This should work now

dammy
25 Jun, 2023, 09:28

I do not know why it did not

Hassanmrwt
25 Jun, 2023, 09:30

Set collection permissions to any with write to true

dammy
25 Jun, 2023, 09:33
Drake
25 Jun, 2023, 14:32

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

dammy
27 Jun, 2023, 09:55

okay @Steven I appreciate you

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