Hello,
I'm currently exploring Appwrite and try to just connect it through web and get the content of a Database Collection.
I'm using CDN with this configuration in my HTML :
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="JS/appWrite.js"></script>
appWrite.js :
const { Client, Databases, Query } = Appwrite;
const client = new Client();
const databases = new Databases(client);
client
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("653ba2ff5cf5f9554ff6"); // Your project ID
const promise = databases.listDocuments(
"653ba48f8fb4b1a438f4",
"653ba54d486d9d936563"
);
promise.then(
function (response) {
console.log(response); // Success
},
function (error) {
console.log(error); // Failure
}
);
I don't understand how to fix the 401 error I encounter in the console (after looking into different documentations).
I have try to add in client setKey with an API Key without success.
Does anyone have a clue on how to fix this ?
Thank you in advance and have a good day !