I want to get users location server side. Looking at documentation the locale.get() doesn't ask for user ID or any other details? What users locale will it provide ?
I am trying to restrict access to information based of user location. A request document is created in a collection and information is populated in the document basis country by a cloud function.
Summary
The user wants to know how to use the Locale service server-side. The answer is that the common use case is for API calls to be made from the client. If you call locale.get server-side, it will return the location of the server. It is best to use locale on the client-side only. The API grabs the IP address of the requester and looks up the location based on that. If you make the API call from another server, the request will come from your server, not the end user. The user wants to get the user's location server-side but the locale.get() function doesn't ask for the user ID or
Drake
Admin
Apr 7, 2023, 20:46
That API grabs the IP address of the requester and looks up the location based on the IP. If you're making the API call from some other server the request will come from your server rather than the end user.
punti_z
Rank 3: Container
Apr 7, 2023, 20:49
So calling locale.get server side (using appwrite functions) would return location of the server then ? Not sure I understand the use case of that..
So ideally locale should be used client side only
Drake
Admin
Apr 7, 2023, 20:51
Yes. The common use case is for api calls to be made from the client