Branchwell

Bucksley / app / connect

Latest: App source: current code by Branchwell, 1 hour ago

📁 src
📄 .gitignore35 B
📄 README.md1.5 KB
📄 wrangler.jsonc237 B

connect.bucksley.ai

A Cloudflare Worker that lets the Bucksley Mac app sign in with Coinbase. Coinbase needs a client secret to swap a sign-in code for tokens, and an app can't keep a secret, so this Worker adds it and passes the request through. It has no storage, keeps nothing and logs no tokens.

Routes

  • GET /coinbase/config returns { client_id, redirect_uri, scope }, or 503 not_configured. The app shows "Sign in with Coinbase" only when this answers 200.
  • GET /oauth/callback 302s Coinbase's code, state or error on to bucksley://coinbase/callback.
  • POST /coinbase/token takes JSON with grant_type authorization_code (plus code and code_verifier) or refresh_token (plus refresh_token), adds the secret and forwards it to https://login.coinbase.com/oauth2/token. Only the tokens come back.

Deploy

cd connect && npx wrangler deploy

The Worker is bucksley-connect on the bucksley.ai Cloudflare account, served on the custom domain connect.bucksley.ai.

Secrets

Coinbase OAuth client creation is limited to approved partners. Once Coinbase approves Bucksley, create the client at https://portal.cdp.coinbase.com/oauth with the redirect URI https://connect.bucksley.ai/oauth/callback, save the secret in Bitwarden Secrets Manager as BUCKSLEY_COINBASE_CLIENT_SECRET, then:

echo -n "<client id>" | npx wrangler secret put COINBASE_CLIENT_ID
bws secret get <id> | jq -r .value | npx wrangler secret put COINBASE_CLIENT_SECRET