Open
Description
Describe the bug
I just have a question:
The python guide suggested using the python logto client instance as a global instance.
But looking at the implementation, i'm a bit confused:
how does logto client API, .e.gisAuthenticated()
knows which user the "idToken" belongs to when there are multiple users try to login at same time?
Look at below python implementation, the storage key is just a static string, i.e. "idToken", it can't be used to differentiate different users who try to log in at the time.
the same question applies to other APIs like handleSignInCallback()
.
def isAuthenticated(self) -> bool:
"""
Check if the user is authenticated by checking if the ID Token exists.
"""
return self._storage.get("idToken") is not None
In other words, when there are multiple users try to login at same time, wouldn't one signInSession overwrites other signInSession(s) because the key is just a static string?
Thanks
- Logto CloudSelf-hosted, Logto version =
- Container (Docker image)
- Raw Node.js
Screenshots
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
xiaoyijun commentedon Jan 17, 2025
Hi @humpydonkey , currently, Logto SDK do not support multiple users logging in simultaneously.
May I ask about your specific scenario? In what situation do you need multiple users to log in at the same time?
uraurora commentedon Jun 10, 2025
I share this concern. Given that multiple users will access the application concurrently, how does the global Logto instance manage and differentiate user tokens?
charIeszhao commentedon Jun 17, 2025
IMO this seems to be a related ticket report to #36. The sign-in session should be cached and the key should be determined by request parameters instead of static string. A similar mechanism is applied in our JS SDK family.
We are aware of this issue in Python SDK right now, and working on a patch.
Meanwhile, you are also welcome if you would consider contributing the code. Anyways, thanks for the report and we'll update it once we have any an update.