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
- Collections list not showing up when try...
I'm trying to create new relationship attribute but both one way and two way relationship is not showing up collections list to connect with my relationship att...
- I have try to use the appwrite in to the...
Invalid Origin. Register your new client (oailedjdbkhlkakmnnapoonllbnfmfij) as a new Web (Chrome Extension) platform on your project console dashboard
- Paused project can't activate
I have failed to reactivate one my projects which had been paused