Given a users ID how can I get that users email and name from that Auth table?
I've tried this:
TypeScript
// middleware
export function createSessionClient(request: Request) {
const client = new Client()
.setEndpoint(import.meta.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(import.meta.env.PUBLIC_APPWRITE_PROJECT)
...
return {
...
get users() {
return new Users(client)
},
}
...
// another component
const { users } = createSessionClient(Astro.request)
console.log('a user: ', await users.get('00ac6251002f1e33b849'))
And I always get: (role: users) missing scope (users.read) Even though I've enabled users.read (screenshot)
TL;DR
To get a user's email and name from the Auth table using the Appwrite SDK, you must grant the users.read scope. Ensure the scope is enabled despite already checking it, as it seems to be the root cause of the issue you are facing.Recommended threads
- Cloud function deployment failures
When I run appwrite push functions, select the function I want to deploy, confirm with a YES, is starts deploying but goes into error. I need to repeat the ste...
- Function deployment failed: Unable to re...
Hi Appwrite team, I have been experiencing persistent errors when i attempt to push my appwrite functions. The logs on the deployment detail page on the console...
- One to many 2 way, console UI not correc...
Hey, seems I'm facing the exactly same issue with this one: https://github.com/appwrite/appwrite/issues/6016 Since this Github issue stay open for so long, let ...