I did
I have both Web and Android but I'm building for Web first
Do I need to set up the API Key?
than add the web on the platform?
If you have than you should.
I did. Its already there.
The quickstart code doesn't show how to use API key though.
can you share the logs
AppwriteException: User (role: guests) missing scope (account)
at Client.<anonymous> (file:///C:/Users/User/sides/ladanglink/node_modules/appwrite/dist/esm/sdk.js:655:23)
at Generator.next (<anonymous>)
at fulfilled (file:///C:/Users/User/sides/ladanglink/node_modules/appwrite/dist/esm/sdk.js:19:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 401,
type: 'general_unauthorized_scope',
response: {
message: 'User (role: guests) missing scope (account)',
code: 401,
type: 'general_unauthorized_scope',
version: '1.6.1'
}
}
I got it to work
import { Client, Account, ID } from "appwrite";
const client = new Client()
.setProject(import.meta.env.VITE_APPWRITE_PROJECT_ID); // Your project ID
const account = new Account(client);
const promise = account.create(ID.unique(), 'email@example.com', 'password');
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
It seems I don't need to specify the endpoint... strange
oh wait... its still not working when trying to get the account
Do one thing check the session for the account
how do I check?
Yes
I tried. Still same error message.
Code that I tried
import { Client, Account } from "appwrite";
const client = new Client()
.setProject('Your Project ID'); // Your project ID
const account = new Account(client);
const user_account = await account.getSession('current');
console.log(user_account); // Success
Of course I swap out the Project ID with the actual Project ID
Maybe I'm doing this wrong
I want to check if the user is logged in or not when the app is opened on their device
If the user is logged in, then they can see the dashboard
If not, direct them to the login/sign up page
I figure it should be checking if that account or session exists but not sure how to go about it
Recommended threads
- Self Hosting accessing AppWrite Console ...
Hey folks, I'm building out an application that helps people design offshore windfarms and looking to leverage AppWrite. I've used the hosted version for a cou...
- account.get() does not check if Appwrite...
This is problematic... Users can simply just unlink from the Google website, and Appwrite just... doesnt know??
- Query.equals - boolean value check
I'd like to check for boolean values, for example like this: ```const { total, documents } = await databases.listDocuments( databaseId, userCol...