Back

update status http request

  • 1
  • Flutter
rafaat
2 Jun, 2023, 19:03

Hi, hope you are doing well I'm trying to update user status, specifically block a user with patch request as you can see in the images, but status will not get updated. note that I can update others stuff like user name or email.

TL;DR
User is trying to update user status via HTTP requests but is facing an error when using self-signed certificate. They are also trying to block a user using API but the client SDK does not provide a function for it. A possible solution is to change the endpoint to HTTPS instead of HTTP and to use an Appwrite Function with restricted access instead of exposing the API key in a flutter app.
Drake
2 Jun, 2023, 19:08

would you please try with HTTPS instead of HTTP?

Also...you're using an API key in a flutter app? That's not safe 👀

rafaat
2 Jun, 2023, 19:23

@Steven Sorry but you mean by changing endpoint string? not the local host, cuz I just did and I'm getting an error(unable to get local issuer certificate....). in my application there is an admin that registers and deletes other users, the only problem is the client SDK doesn't provide a function to block or delete a user. so i have to use API

Drake
2 Jun, 2023, 19:25

you mean by changing endpoint string?

yes. You'll need to call client.setSelfSigned() since you don't have a valid certificate.

the only problem is the client SDK doesn't provide a function to block or delete a user. so i have to use API

If you use an API key in a flutter app, anyone with the flutter app will have your API key. Instead, you should expose an Appwrite Function that only some users are allowed to execute.

rafaat
2 Jun, 2023, 19:38

@Steven thanks Mr Steven actually I was using selfSigned on my client SDK endpoint as you can see in the image, but I just manually blocked a user in the console then tried to unblocked via API it worked, but yet I can't block any user so I think there might be a bug, but as you said I'm thinking of using a function thanks for your time

Drake
2 Jun, 2023, 19:41

Oh oops. The set self signed won't work because you're making requests with http library

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