Skip to main content

Function: setPaperSession()

setPaperSession(session, pdsEndpoint, handle): PaperSession

Defined in: web/lib/auth/paper-session.ts:100

Store a paper session after successful popup OAuth.

Parameters

session

OAuthSession

OAuth session from paper account login

pdsEndpoint

string

Paper's PDS endpoint URL

handle

string

Paper's handle

Returns

PaperSession

Paper session object

Remarks

Creates an Agent from the OAuth session and stores it. Also sets this as the active paper session.

Example

// In popup callback handler
const session = await handleOAuthCallback();
const paperSession = setPaperSession(session, pdsEndpoint, handle);
console.log(`Authenticated as ${paperSession.paperHandle}`);