Back

Want to clarify things first.

  • 0
  • Databases
  • Functions
Mosh Ontong
2 Dec, 2023, 02:24

I have this function and I will use the set jwt token. Now the client side will pass a jwt token for that cloud function I want answers for all this questions:

  1. In server side if I account.get. I can get the user info even I am in the server side right?
  2. I am going to create documents and set a permissions to the specific user, not himself/herself. Because in client side when I try to set a permission to referred to another user it gives me an error, so In server side can I able to do this ?
TL;DR
The user wants to clarify a few things. They ask if the team will implement a feature to set permissions for someone else in the future. They also mention that the client does not need to pass a JWT and that certain headers are automatically filled when the user is logged in. They question why they need to call account.get() and mention that using a JWT is the same as making the API call client side. They mention that to set permissions for someone else, an API key should be used. However, they are facing errors when trying to create permission for another user. They plan to use a JWT token instead of the API key
zdanl
2 Dec, 2023, 04:02

I can't parse the first part of your question, but the 2. - yes if you have a privileged API key.

But then it also works from the client

Mosh Ontong
2 Dec, 2023, 04:47

I will use jwt token insteaf using the api key.

Mosh Ontong
2 Dec, 2023, 04:49

I am getting error when I am creating permission specific user excluding self id, for example User B will have permission to write this document. IN that case it will throw an error

Mosh Ontong
2 Dec, 2023, 04:50

But nvm

Drake
2 Dec, 2023, 05:23

Using a JWT is the same as making the API call client side as the user.

If you want to set permission to someone else, you must use an API key

Drake
2 Dec, 2023, 05:25

Btw, the client doesn't need to pass a JWT. If they're logged in and they execute function, 2 headers are automatically populated with the user's id and JWT. See the docs.

Yes, calling account.get() with a JWT will get that user.

Why do you need to call account.get()?

Mosh Ontong
2 Dec, 2023, 07:46

Just nothing heheh just want to clarify. Btw, does the team will implement that allow us to to set permission to someone else in the future or not?

Drake
3 Dec, 2023, 00:48

Probably not

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