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
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...