Skip to content

add LogtoBaseClient with only the server-side configuration #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BeautyyuYanli
Copy link

@BeautyyuYanli BeautyyuYanli commented Jul 1, 2025

The class for the Logto client with only the server-side configuration, no user-side storage.

Which can resolve #34 #36 , without change the API of LogtoClient

    config = LogtoConfig(
        endpoint="https://logto.app/",
        appId="your-app-id",
        appSecret="your-app-secret",
    )
    client = await LogtoBaseClient.new(config)
    
    class SessionStorage(Storage):
        # Implement the Storage interface to store the user-side data
        # Which can read and write the data from the request session (cookies or somewhere else)
        ...
    async def login(request: Request):
        session_storage = SessionStorage(request.session)
        user_client = await client.get_user_client(session_storage)
        user_client.signIn()
        ...
        
    async def protected_route(request: Request):
        session_storage = SessionStorage(request.session)
        user_client = await client.get_user_client(session_storage)
        user_client.isAuthenticated()
        ...

@BeautyyuYanli
Copy link
Author

BeautyyuYanli commented Jul 1, 2025

The only problem is that if the OidcCore safe for sharing across different LogtoClient. After checking the source code I believe it is yes

@BeautyyuYanli
Copy link
Author

@gao-sun waiting for review 🙏

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

Successfully merging this pull request may close these issues.

bug: how does Python client support multiple users
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy