import { ChatATPClient, OAuthClient } from "@chatatp/studio";
const oauth = new OAuthClient();
const { verifier, challenge } = await OAuthClient.createPkce();
const state = crypto.randomUUID();
const authorizationUrl = oauth.authorizationUrl({
clientId: process.env.CHATATP_CLIENT_ID!,
redirectUri: "https://your-app.example.com/oauth/callback",
scopes: ["agents:read", "conversations:read", "messages:send"],
state,
codeChallenge: challenge,
codeChallengeMethod: "S256",
});
// Store state and verifier in the user's server-side session.
// Redirect the user's browser to authorizationUrl.