Web Developer
Hello,
I'm coming from firebase and am excited to experiment with you guys. I am curious how my react app can create a user with only the following
import { Client, Account, ID } from "appwrite";
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<PROJECT_ID>'); // Your project ID
const account = new Account(client);
const promise = account.create('[USER_ID]', 'email@example.com', '');
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
I would expect I would need to set an api key or secret as an env var in my vite react app, for example via VITE_APPWRITE_API_KEY.
If someone sees my code can they write the above code and execute actions on my stuff?
Or is the "protection" coming from the Hostname setting when I add a platform?
Or should there be verbiage in the docs saying that the api endpoint and project id should be secrets?