Replies: 1 comment
|
For a browser application: const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject(PROJECT_ID)
const account = new Account(client)
await account.createEmailPasswordSession(email, password)
const user = await account.get()Use the same Appwrite endpoint/project for both calls and let the SDK/browser carry the session cookie. Do not put a project API key in frontend code. If Useful checks:
Appwrite's own service docs distinguish these scopes: the Account API operates as the current logged-in user, while the Users API is server-side/admin-scoped. If this resolves the guest-scope error, please mark the reply as accepted. |
Uh oh!
There was an error while loading. Please reload this page.
I have the basic sign up form and everything working and tested out the frontend and I see after a successful user sign-up the user is in fact sent to their dashboard correctly and Appwrite is adding the user just fine.
But now I am having difficulty with the Appwrite user authentication. After going through the docs and trying out several different setups I cannot seem to get Appwrite to authenticate and say "Yep, thats a logged in User alright'.
API action that is called 'auth_check' and it is suppoed to confirm that person is logged in and provide back the logged in user details. But I keep getting the same error message from Appwrite:
{"message":"User (role: guests) missing scope (account)","code":401,"type":"general_unauthorized_scope","version":"1.5.7"}But I have full permissions on my one and only secret api key that i have with Appwrite for my specific project, and i checked all the other variables and confirmed them as well.
So i must be missing something in my headers or JSON Body I am assuming to pass onto Appwrite? Can anyone let me know if i am missing something in the Headers / JSON Body? The user can sign-up, and gets added to the Auth section of Appwrite but now authenticating them, and making sure they are a user before allowing them to go to /Dashboard is where I am having trouble.
What am I missing?
All reactions