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
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...