Resolves #16
+21
-6
bun.lock
+1
docs/package.json
+2
docs/src/index.ts
+48
-20
docs/src/lib/session.ts
+8
-1
docs/src/routes/auth.ts
+314
docs/src/routes/subscribe.ts
+1
-1
docs/wrangler.toml
+21
-10
packages/cli/src/commands/add.ts
+464
packages/cli/src/components/sequoia-subscribe.js
History
4 rounds
14 comments
expand 2 comments
oop nvm, see its there now; we're good!
expand 1 comment
I wasn't able to test e2e. I can get to the /subscribe page and authenticate, but with the static and API sites running on different ports I don't get a proper callback.
expand 11 comments
@stevedylan.dev this is closed, but I'm having trouble verifying it e2e. I swapped out the CLIENT_URL variable for my local instance, but seems I need both the static site and wrangler site (on separate ports) running simultaneously and I'm not sure the flow is working right between the two as it might for Cloudflare. Is this something you can test easily, or maybe have some pointers? Does Cloudflare somehow proxy the calls to seem like a single site?
All that said, the flow seems to almost work right. I had to disable CORS for localhost on my machine but that should just be because it's localhost. I explicitly set the callback-uri in my SSG to test this all out. The rendered pages are somewhat themed. Not sure how vocs is setting the class on the HTML root element, but I have a script doing it here.
The auto-hide functionality also works if the publication-uri isn't set or isn't discoverable from /.well-known.
I suppose I should add a help topic before calling this "done", too. Something short and sweet like the Comments topic.
I suppose I should add a help topic before calling this "done", too. Something short and sweet like the Comments topic.
@heaths.dev Awesome!! Yeah I can definitely test this later. I think if you run bun dev:api inside the docs folder it should spin up the actual API and render the site as the same time, so that should make it easier to test!
We also probably need to update the CORS on the index.ts file too, something like seen here: https://hono.dev/docs/middleware/builtin/cors
Whew, ok had to do some deep testing and deployment of code that still got me pretty stuck. Here's where we're at:
- We need to add these cors settings to the index.ts file
import { cors } from "hono/cors";
// Other imports and initial hono app
app.use(
"/subscribe/*",
cors({
origin: (origin) => origin,
credentials: true,
}),
);
app.use(
"/subscribe",
cors({
origin: (origin) => origin,
credentials: true,
}),
);
- For some reason the OAuth client really doesn't play well with cloudflare workers. Here's an example error:
GET https://sequoia.pub/oauth/login?handle=stevedylan.dev - Ok @ 2/24/2026, 8:11:56 PM
(error) Identity resolution failed: DidError did-unknown-error (did:plc:ia2zdnhjaokf5lazhxrmj6eu): Invalid redirect value, must be one of "follow" or "manual" ("error" won't be implemented since it does not make sense at the edge; use "manual" and check the response status code).
(error) Login error: Error: Failed to resolve identity: stevedylan.dev
I know with the CLI we use the @atproto/oauth-client-node so maybe that's the answer. Will see if I can take another crack at it later.
Figured it out!! What a pain in the ass lol. Ok here's what we need to do:
-
Create a new file
docs/src/lib/path-redirect.tswith these contents and then import it todocs/src/index.tslike soimport "./lib/patch-redirect";. This will solve the weird cloudflare worker issues with the atproto oauth client library and how it handles redirects. -
Update all instances of
scope: "atproto transition:generic"toscope: "atproto site.standard.graph.subscription" -
The cors updates seen in the previous comment
I made these changes locally and deployed it so you can try it out from localhost and it should work! We just need to get the actual code committed and merged.
Also on the final screen where it shows the user that we created the records, could be nice to link to a pds.ls URL like so
https://pds.ls/at://did:plc:ia2zdnhjaokf5lazhxrmj6eu/site.standard.graph.subscription/3mfnrenwnps2h
Hold off on changing the scopes; started having weird issues with it so reverted to what you already have
Ok tested some more with scopes and I'm not sure what I was doing wrong before, perhaps an old session, but I confirmed it's working as expected. Just need to update the following lines:
docs/src/routes/auth.ts:30,47 docs/src/lib/oauth-client.ts:22
scope: "atproto repo:site.standard.graph.subscription"
Hey, sorry for not responding earlier and thanks so much for testing this with Cloudflare! I was building the docs site okay. The problem I was running into was that the static site was served from a different port than the API, and crossing between the two was having additional CORS issues than just the ones I expected tested against localhost that I temporarily worked around.
Since you already have the changes, do you just want to push them to this PR since you can actually test them? Given our previous thread, I don't mind that at all - it's collaboration! :) That was different than the other PR.
That said, not sure if you're online right now so I'll take a look through your changes and incorporate what I can. I'll even try to test but, like I said, without testing in an actual test environment on Cloudflare (or something like it), not sure how realistic testing would be.
1 commit
expand
collapse
Resolves #16
Excellent; thank you!! I'll make some follow up changes with the fetch-patch for the worker. Really appreciate your help here!