Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot log in with did:web #214

Open
hugeblank opened this issue Dec 3, 2024 · 3 comments
Open

Cannot log in with did:web #214

hugeblank opened this issue Dec 3, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hugeblank
Copy link

hugeblank commented Dec 3, 2024

Describe the bug
When attempting to log in with a handle that's associated with a did:web, the Application error screen occurs. Or at least that's what I imagine is happening.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://frontpage.fyi/login
  2. Type in a handle associated with a web DID (eg: hugeblank.dev)

Expected behavior
A redirect to my pds, then a successful log in.

Desktop (please complete the following information):

  • OS: archlinux
  • Browser: firefox
  • Version: 133.0
Copy link

linear bot commented Dec 3, 2024

@tom-sherman tom-sherman added the bug Something isn't working label Dec 3, 2024
@hugeblank
Copy link
Author

@tom-sherman I'm attempting to make a PR for this: using pnpm run dev in packages/frontpage doesn't work, and I have no idea what the op command is in the dev-1pw script.

@hugeblank
Copy link
Author

hugeblank commented Dec 6, 2024

Regardless, here's what I assume is the fix, completely untested due to the above:

diff --git a/packages/frontpage/lib/data/atproto/did.ts b/packages/frontpage/lib/data/atproto/did.ts
index 2d4488e..71d3185 100644
--- a/packages/frontpage/lib/data/atproto/did.ts
+++ b/packages/frontpage/lib/data/atproto/did.ts
@@ -16,8 +16,9 @@ export function parseDid(s: string): DID | null {
 }
 
 export const getDidDoc = cache(async (did: DID) => {
-  const url = process.env.PLC_DIRECTORY_URL ?? "https://plc.directory";
-  const response = await fetch(`${url}/${did}`, {
+  const components = did.split(":")
+  const url = components[1] == "web" ? `https://${components[2]}/.well-known/did.json` : `${process.env.PLC_DIRECTORY_URL ?? "https://plc.directory"}/${did}`;
+  const response = await fetch(url, {
     next: {
       // TODO: Also revalidate this when we receive an identity change event
       // That would allow us to extend the revalidation time to 1 day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants