Basically what the title states, cant read the database. It returns the following error
AppwriteException: The current user is not authorized to perform the requested action.
at Client.<anonymous> (file:///C:/Users/meera/GithubDesktop/PitchFork/node_modules/appwrite/dist/esm/sdk.js:391:27)
at Generator.next (<anonymous>)
at fulfilled (file:///C:/Users/meera/GithubDesktop/PitchFork/node_modules/appwrite/dist/esm/sdk.js:22:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 401,
type: 'user_unauthorized',
response: {
message: 'The current user is not authorized to perform the requested action.',
code: 401,
type: 'user_unauthorized',
version: '0.10.19'
}
}
I am really new to appwrite so help is appreciated.
Here is the code:
import { Client, Account, ID, Databases, Permission, Role, Teams } from 'appwrite';
const client = new Client();
const account = new Account(client);
client
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('646521b8048d4efcd171');
const databases = new Databases(client);
const promise = databases.listDocuments('646522094815b3cf7be4', '64652215e10e469f9e37');
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
// create the user session
account.createEmailSession('me@example.com','password').then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
Everything seems fine.
Cannot read the Database
why is it giving me the error?
In your Appwrite console add permission to the collection
??
ok
you mean a create a collection called Permission?
You'll need to go to Settings
tab inside your collection
Then you can add and set permission for user(s) group
In my example you can see Any
have access to Read
this collection
yep
got it
it works
tysm @Binyamin
[SOLVED] Cannot read the Database
Recommended threads
- Got message for auto payment of 15usd fo...
how did this happen? 1. i claimed my 50usd credits via jsm hackathon - https://hackathon.jsmastery.pro/ 2. it asked me which org. to apply the credits on, i se...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...