Hello everyone! I'm curious about how you manage User IDs in client-server communication. Here are the specific conditions:
• User Identification and Logging: The server uses User IDs to identify users and logs their actions.
• Third-Party User Management: User management is handled by a third-party service (e.g., Firebase, Supabase), with a direct database access URL.
• User ID Ownership: The User ID belongs to the logged-in user (device).
• Client-Side Usage: The User ID is not used on the client-side.
• Frequent Logging: Logs are generated approximately once every 2-3 seconds.
• JWT Usage: JWTs can be used by the server to identify users.
I've considered the following approaches:
Case 1: Storing User ID in Client-Side Memory
• Communication: HTTPS is used for communication, and the User ID is sent in the body of the request, not exposed in the URL.
• JWT and User ID: A JWT is included in the header, and the User ID is sent in the body if needed.
• Concerns: Are there any security risks or other issues with temporarily storing the User ID on the client and sending it in API calls?
Case 2: Using Only JWT for API Calls
• Communication: A JWT is included in the header, and the User ID is not stored on the client.
• Server-Side Lookup: The server accesses the third-party database to find the User ID.
• Concerns: Is the latency introduced by accessing the third-party database significant?
When using JWTs for user identification on the server, it requires accessing the third-party database, which might introduce a slight delay.
Thank you guys and have a wonderful day 😛
not kotlin but kotlin colored 4