Hi there I am looking forward to add the user id in all requests sent by flutter sdk , but I am not sure how to do it , I know where is the base_request in client_io and client_browser , but I can't find the best way to check if user is signed in and to call his id in the sdk itself to add this for the base request , so if someone can help in ty
Why do you need to send the user id when using the Appwrite flutter sdk?
What's your use-case? Why exactly do you need to send the user id?
You can just use account.get() to see if the user is logged in or not
I am logging all requests of my server using reverse proxy , so I want to know which user is sending the request for security purposes , I have cookies of user but I Think it's only stored locally
that's won't work for the sdk as u need to initiate client which isn't possible with easy way from sdk
I’m confused. Why is initializing a client hard?
it’s just 3 lines of code
How are you login your requests?
With cloud functions and triggers you can achieve this and get the user id without any extra step. In the function, you can add the logic to store this info in a collection or in any way you want
cause I get this error when I try to call the client in the sdk it self , cause i am not sure how it's being manager , I tried " client.setEndpoint('myendpoint').setProject('projectname'); " and got same error
I am running appwrite behind nginx , which is doing logs for all request , so I want to edit the sdk to send the user id itself , I can't depend on functions ,cause I have full system in behind to manage logs with another apps depends on nginx logs files so can't use appwrite function to manage logs and if I did it won't be that accurate that can nginx does with another special apps
I see, so one thing could be add a header with the userId on each request, if you get the header is because the user is logged
Actaully I found a ready function in "ClientIO" called "addHeader"if u called it at the begining of project it will add the header autoamtically to all requests without needng to modify all request and without needing to modify the Sdk it self as I did before .
will leave a picture here if someone serached for it in future
ty for helping for every one <:appwriteheart:782571497393750036>
[Solved] Flutter SDK
Recommended threads
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...
- Compatibility issue with Kakao OpenID Co...
**Context:** I am attempting to integrate **Kakao Login** (one of the largest social login providers in South Korea) into my Flutter application using Appwrite'...
- [SOLVED] Appwrite 25.1.0 returns Invalid...
I've already opened an issue on GitHub, but somewhat it doesn't seem like GitHub is monitored very closely, so I'm leaving a bug report here on Discord as well....