Skip to content

Releases: vineyardbovines/better-auth-atproto

Release list

0.1.0

Choose a tag to compare

@vineyardbovines vineyardbovines released this 07 Apr 23:17

v0.1.0 - Initial Release

AT Protocol OAuth plugin for better-auth. Sign in with Bluesky or any atproto PDS.

Features

  • Full OAuth 2.0 + PKCE + DPoP flow via @atproto/oauth-client-node
  • Loopback client support, no tunnels or private keys needed for dev
  • Auto-hosted discovery endpoints - /atproto/client-metadata.json and /atproto/jwks.json served by the plugin
  • OAuth state and session data persisted via better-auth's database adapter
  • Profile sync - DID, handle, display name, avatar, bio, and banner stored on the user table
  • Respects account.accountLinking.enabled; links atproto to existing logged-in users
  • GET /atproto/session and POST /atproto/restore for making authenticated atproto API calls
  • Sign-in (5/60s) and callback (10/60s) rate limited by default
  • Option to restrict to existing users only
  • Customize how atproto profiles map to user fields
import { atproto } from "better-auth-atproto";

export const auth = betterAuth({
  plugins: [atproto({ privateKey: process.env.ATPROTO_PRIVATE_KEY })],
});

import { atprotoClient } from "better-auth-atproto/client";

const authClient = createAuthClient({
  plugins: [atprotoClient()],
});

await authClient.signIn.atproto({ handle: "thepope.dev" });