-
-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Description
I'm integrating Bluesky authentication via OAuth into a web app with a custom backend built on atproto.blue and FastAPI. I've successfully implemented the frontend OAuth flow using @atproto/oauth-client-browser, but I'm struggling to use the acquired data to authenticate my atproto.blue client instance.
Use Case
I need an authenticated client instance to perform specific queries and calculations via a custom service:
from atproto_client import Client
class BlueskyService:
def __init__(self, client: Client):
if not isinstance(client, Client):
raise ConnectionRefusedError("Invalid atproto client instance")
self.client = client
def get_followers(self, handle: str) -> set[str]:
following = self.client.app.bsky.graph.get_followers(params={"actor": handle})
# ... calculate some cool stuff ...From what I've gathered, the only authentication options are client.login('handle', 'password') or client.login(session_string="exported_session_string_after_successful_authentication"), and I'm failing to understand how (or if) I can achieve either of these with OAuth on the frontend. I've examined the exported session string format handle:::did:::accessToken:::refreshToken:::serviceEndpoint but can't determine how to properly construct this.
Request
Could you please add support for:
- Authenticating a
Clientinstance using the OAuth session data. - A clear example of how to integrate with frontend OAuth flows.
- Documentation on the proper way to handle the OAuth flow in a web application context.
Many apps will need to implement Bluesky authentication without handling user passwords directly. A standardised OAuth flow would greatly improve security and user experience across all applications.
Is something like this even possible?
Thanks for your time and hard work! 🙏