Back

SSR examples (svelte)

  • 0
  • Self Hosted
  • Auth
  • Databases
  • Web
BobcatProgrammer
18 Mar, 2024, 22:49

So I followed the tutorial here https://appwrite.io/docs/tutorials/sveltekit-ssr-auth/step-1 with my self-hosted instance on v1.5.3. Login works nicely. However if I then try to use the logged in user to read docs from a collection i get an error:

TypeScript
  code: 401,
  type: 'general_unauthorized_scope',
  response: {
    message: 'user@example.com (role: users) missing scope (collections.read)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: '1.5.3'
  }
}```
I am using the user session client  as created in the example here https://github.com/appwrite/demos-for-svelte/blob/74be81a18142be31f7a818f2e58693b2682909ff/server-side-rendering/src/lib/server/appwrite.ts#L18 to call the `db.listDocuments`
I explicitly made sure the collection is set to allow CRUD for `Any` and `Role: Users`. Still I get the error. Is this a bug or am I not supposed to use `node-appwrite` on server-side with a user session client?
TL;DR
Developers followed a tutorial for SSR with Svelte and Appwrite v1.5.3, successfully implemented user login but encountered a 401 error when trying to read docs from a collection. The error indicates missing scope 'collections.read' for the logged-in user. The collection settings seem correct, so the issue might be with using `node-appwrite` on the server-side with a user session client. Further troubleshooting is recommended.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more