Framework-agnostic OAuth integration for AT Protocol (Bluesky) applications.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 55 lines 1.6 kB view raw
1/** 2 * @module atproto-oauth 3 * 4 * Framework-agnostic OAuth integration for AT Protocol applications. 5 * 6 * Provides complete OAuth flow handling for Bluesky/ATProto authentication 7 * using standard Web Request/Response APIs. Works with any framework. 8 * 9 * @example 10 * ```typescript 11 * import { createATProtoOAuth } from "@tijs/atproto-oauth"; 12 * import { SQLiteStorage, sqliteAdapter } from "@tijs/atproto-storage"; 13 * 14 * const oauth = createATProtoOAuth({ 15 * baseUrl: "https://myapp.example.com", 16 * appName: "My App", 17 * cookieSecret: Deno.env.get("COOKIE_SECRET")!, 18 * storage: new SQLiteStorage(sqliteAdapter(sqlite)), 19 * }); 20 * 21 * // Mount routes in your framework 22 * app.get("/login", (c) => oauth.handleLogin(c.req.raw)); 23 * app.get("/oauth/callback", (c) => oauth.handleCallback(c.req.raw)); 24 * app.get("/oauth-client-metadata.json", () => oauth.handleClientMetadata()); 25 * 26 * // Get session in protected routes 27 * const { session, setCookieHeader } = await oauth.getSessionFromRequest(request); 28 * ``` 29 */ 30 31// Main factory function 32export { createATProtoOAuth } from "./src/oauth.ts"; 33 34// Session management 35export { OAuthSessions } from "./src/sessions.ts"; 36 37// Client metadata 38export { generateClientMetadata } from "./src/client-metadata.ts"; 39 40// Types 41export type { 42 ATProtoOAuthConfig, 43 ATProtoOAuthInstance, 44 ClientMetadata, 45 Logger, 46 OAuthClientInterface, 47 OAuthSessionFromRequestResult, 48 OAuthSessionsInterface, 49 OAuthState, 50 OAuthStorage, 51 SessionData, 52 SessionInterface, 53 SessionValidationResult, 54 StoredOAuthSession, 55} from "./src/types.ts";