dahlia / fedify

ActivityPub server framework in TypeScript
https://fedify.dev/
MIT License
563 stars 20 forks source link

FetchError 401 requesting mastodon v4.2.8 user #42

Closed reggi closed 6 months ago

reggi commented 6 months ago

Blog example throws an error:

FetchError: https://indieweb.social/users/thomasreggi: HTTP 401: https://indieweb.social/users/thomasreggi
    at getRemoteDocument (https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/runtime/docloader.ts:73:11)
    at fetchDocumentLoader (https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/runtime/docloader.ts:94:10)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/runtime/docloader.ts:203:25
    at async verify (https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/httpsig/mod.ts:154:24)
    at async handleInbox (https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/federation/handler.ts:251:15)
    at async Federation.fetch (https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/federation/middleware.ts:882:16)
    at async https://jsr.io/@fedify/fedify/0.7.0-dev.120+4c00fc5e/x/fresh.ts:117:12
    at async handler (https://deno.land/x/fresh@1.6.8/src/server/context.ts:293:14)
    at async ext:deno_http/00_serve.js:455:18 {
  url: URL {
    href: "https://indieweb.social/users/thomasreggi",
    origin: "https://indieweb.social",
    protocol: "https:",
    username: "",
    password: "",
    host: "indieweb.social",
    hostname: "indieweb.social",
    port: "",
    pathname: "/users/thomasreggi",
    hash: "",
    search: ""
  },
  name: "FetchError"
}

from a mastodon server indeweb.social running

{
  "version": "2.0",
  "software": {
    "name": "mastodon",
    "version": "4.2.8"
  },
  "protocols": [
    "activitypub"
  ],
  "services": {
    "outbound": [],
    "inbound": []
  },
  "usage": {
    "users": {
      "total": 11387,
      "activeMonth": 1373,
      "activeHalfyear": 2298
    },
    "localPosts": 506791
  },
  "openRegistrations": true,
  "metadata": {

  }
}
reggi commented 6 months ago

401 also happens when using this tool https://glitch.com/~activitypub-viewer I'll reach out to my server admin

dahlia commented 6 months ago

I don't think it's a version issue on the Mastodon server, but rather a secure mode setting. You may need an authenticated DocumentLoader.

And if you don't have any actors on your server, consider adopting the instance actor pattern for authentication.