Back

Functions

  • 0
  • Functions
  • Web
  • Cloud
zombikaa
3 Dec, 2024, 18:19

hi, if i have a function, and i need to pass the users id who executed it, how can i do that?

TL;DR
Developers can access the user ID of the person who executed a function using the `APPWRITE_FUNCTION_USER_ID` variable. This can be retrieved using the code `const userId = res.variables['APPWRITE_FUNCTION_USER_ID']`.
Guri
3 Dec, 2024, 18:44

To pass the user ID of the person who executed the function, you need the APPWRITE_FUNCTION_USER_ID variable

TypeScript
const userId = res.variables['APPWRITE_FUNCTION_USER_ID']
Guri
3 Dec, 2024, 18:45

This variable will automatically contain the user's ID who executed the function.

zombikaa
3 Dec, 2024, 18:48

thank you! is there a documentation for other variables like this aswell?

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