Skip to content
Back

Unauthorized database access even after given permission in console

  • 0
  • Databases
Ayomide
15 Feb, 2025, 14:17

I get this error message, i can confirm i have permission set up in console: ``` ⨯ AppwriteException: userwi@gmail.com (role: users) missing scope (collections.read) at async ChatLayout (file://C%3A/Users/USER/Desktop/anonyline/anonyyy/app/chat/layout.tsx:13:15) 11 | const user = await getSafeUser(); 12 | if (!user) return redirect("/login");

13 | const col = await room(); | ^ 14 | console.log(col) 15 | return ( 16 | <main className="flex"> { code: 401, type: 'general_unauthorized_scope', response: [Object], digest: '1242841140' } GET /chat 500 in 5739ms GET /chat 500 in 5748ms GET /favicon.ico?favicon.45db1c09.ico 200 in 269ms GET /favicon.ico 200 in 575ms GET /favicon.ico?favicon.45db1c09.ico 200 in 224ms GET /favicon.ico?favicon.45db1c09.ico 200 in 564ms GET /favicon.ico 200 in 248ms ✓ Compiled in 95ms ○ Compiling /chat ... ✓ Compiled /chat in 620ms ⨯ AppwriteException: &#97;&#x79;&#111;&#109;&#105;&#x64;&#101;&#x6f;&#x6c;&#117;&#x77;&#97;&#x74;&#111;&#x6c;&#97;&#x31;&#64;&#x67;&#109;&#x61;&#x69;&#x6c;&#46;&#99;&#x6f;&#109; (role: users) missing scope (collections.read) at async ChatLayout (file://C%3A/Users/USER/Desktop/anonyline/anonyyy/app/chat/layout.tsx:13:15) 11 | const user = await getSafeUser(); 12 | if (!user) return redirect("/login"); 13 | const col = await room(); | ^ 14 | console.log(col) 15 | return ( 16 | <main className="flex"> { code: 401, type: 'general_unauthorized_scope', response: [Object], digest: '3048564607' } ⨯ AppwriteException: &#x75;&#x73;&#101;&#x72;&#119;&#105;&#64;&#x67;&#x6d;&#x61;&#x69;&#108;&#x2e;&#99;&#111;&#x6d; (role: users) missing scope (collections.read) at async ChatLayout (file://C%3A/Users/USER/Desktop/anonyline/anonyyy/app/chat/layout.tsx:13:15) 11 | const user = await getSafeUser(); 12 | if (!user) return redirect("/login"); 13 | const col = await room(); | ^ 14 | console.log(col) 15 | return ( 16 | <main className="flex"> { code: 401, type: 'general_unauthorized_scope', response: [Object], digest: '763244607' }```

TL;DR
Developers are encountering unauthorized database access errors despite setting up permissions in the console. The error message indicates missing scope `collections.read`. To resolve this, make sure the correct scopes are enabled for the API key being used.
Steven
15 Feb, 2025, 15:52

What scopes did you enable for your API key?

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