Back

[SOLVED] Get the information of a specific user from a function in appwrite

  • 0
  • Databases
  • Functions
MH7
29 Jul, 2023, 16:24

Hi, how can I get the information from the database of a specific user from a function in appwrite. since to obtain the information of a user his login is necessary. but I require it for the administrative part.

TL;DR
To get the information of a specific user from a function in appwrite, you can use the user function variables provided by appwrite. 1. When a user executes the function, two user function variables will be populated: - User id: This is the unique id of the user. - JWT: This is a JSON Web Token that can be used to make requests on behalf of the user. 2. You can use the user id to perform a lookup in the database and retrieve the information of the specific user. 3. Additionally, the JWT can be used to make authenticated requests to appwrite APIs, allowing you to access user
Drake
29 Jul, 2023, 16:33

If the user is executing the function, there are two user function variables populated:

  1. User id
  2. JWT

The user id is the user id of the user so you can do some lookup

The JWT can be used to make requests on behalf of the user.

See https://appwrite.io/docs/functions#functionVariables

MH7
31 Jul, 2023, 17:15

perfect it worked for me, thank you

Drake
31 Jul, 2023, 18:24

[SOLVED] Get the information of a specific user from a function in appwrite

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