import secrets
from chatatp_studio import OAuthClient
oauth = OAuthClient()
verifier, challenge = OAuthClient.create_pkce()
state = secrets.token_urlsafe(32)
authorization_url = oauth.authorization_url(
client_id="your-client-id",
redirect_uri="https://your-app.example.com/oauth/callback",
scopes=["agents:read", "conversations:read", "messages:send"],
state=state,
code_challenge=challenge,
code_challenge_method="S256",
)
# Store state and verifier in the user's server-side session.
# Redirect the user's browser to authorization_url.