Skip to main content

Function: authenticatePaperInPopup()

authenticatePaperInPopup(paperHandle): Promise<PaperSession>

Defined in: web/lib/auth/paper-oauth-popup.ts:193

Start OAuth flow for paper account in popup.

Parameters​

paperHandle​

string

Paper's ATProto handle (e.g., "my-paper.bsky.social")

Returns​

Promise<PaperSession>

Promise resolving to paper session

Remarks​

Opens a popup window for OAuth flow. The user logs in with the paper account's credentials. On success, the session is stored and returned.

Important: Must be called from a direct user action (click handler) to avoid popup blockers.

Throws​

Error if popup is blocked

Throws​

Error if OAuth fails

Throws​

Error if popup is closed before completion

Example​

const handleAuthenticatePaper = async () => {
try {
const session = await authenticatePaperInPopup('my-paper.bsky.social');
console.log(`Authenticated as ${session.paperHandle}`);
} catch (error) {
console.error('Paper auth failed:', error);
}
};

<Button onClick={handleAuthenticatePaper}>
Authenticate Paper Account
</Button>