a simple CLI demonstrating @atcute/oauth-node-client with a public (loopback)
client.
this example shows how to authenticate with AT Protocol OAuth without needing to set up a confidential client with keys. it's useful for CLI tools, local development, and testing.
# authenticate and show your profile
bun run start alice.bsky.social
# or use a DID
bun run start did:plc:z72i7hdynmk6r22z27h6tvurthe CLI will:
- start a local callback server on a random port
- print an authorization URL for you to open
- wait for you to authorize the app
- fetch and display your profile information
loopback clients use http://localhost as the client origin, which the OAuth server recognizes as a
public client. no keys or client registration are required.
import { OAuthClient, scope } from '@atcute/oauth-node-client';
const oauth = new OAuthClient({
metadata: {
// no client_id needed - it's built automatically from redirect_uris and scope
redirect_uris: ['http://127.0.0.1:PORT/callback'],
scope: [scope.rpc({ lxm: ['app.bsky.actor.getProfile'], aud: '*' })],
},
// no keyset - this makes it a public client
actorResolver: /* ... */,
stores: /* ... */,
});the library automatically builds the client_id from the redirect URIs and scope.