#Get user from auth table

3 messages · Page 1 of 1 (latest)

quiet herald
#

Given a users ID how can I get that users email and name from that Auth table?

I've tried this:

// 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)

#

I dont know.... it just started working

#

beats me 🙂