Skip to content

bug: how does Python client support multiple users #34

Open
@humpydonkey

Description

@humpydonkey

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 Cloud
  • Self-hosted, Logto version =
    • Container (Docker image)
    • Raw Node.js

Screenshots

Activity

xiaoyijun

xiaoyijun commented on Jan 17, 2025

@xiaoyijun

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?

added
questionFurther information is requested
and removed
bugSomething isn't working
on Jan 17, 2025
uraurora

uraurora commented on Jun 10, 2025

@uraurora

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?

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

charIeszhao commented on Jun 17, 2025

@charIeszhao
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @humpydonkey@xiaoyijun@charIeszhao@darcyYe@uraurora

      Issue actions

        bug: how does Python client support multiple users · Issue #34 · logto-io/python