First steps: Why is my profile not found on Mastodon Instances?

I am taking my first steps with ActivityPub.
For this I have created static files.

https://dimna.de/.well-known/webfinger/index.php

<?php
$data = '{"subject":"acct:astrid@dimna.de","aliases":["https://dimna.de/user/astrid"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://dimna.de"},{"rel":"self","type":"application/activity+json","href":"https://dimna.de/user/astrid"}]}';
header('Content-Type: application/json; charset=utf-8');
echo $data;

https://dimna.de/user/astrid/index.php

<?php
$data = '{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1"],"id":"https://dimna.de/user/astrid","type":"Person","preferredUsername":"astrid","name":"dimna.de Blog","manuallyApprovesFollowers":false,"discoverable":true,"inbox":"https://dimna.de/user/astrid/inbox","outbox":"https://dimna.de/user/astrid/outbox","following":"https://dimna.de/user/astrid/following","followers":"https://dimna.de/user/astrid/followers","publicKey":{"id":"https://dimna.de/user/astrid#main","owner":"https://dimna.de/user/astrid","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvnJTfuyEgHxTs0UMR0Ee\n2rafvlfQDM+2RTRCAGnZ+ryBrLFBrk7oyIYDKe5ZKkJ2am8N2Y4Z958YppWOaWv+\nSzkqn/0Hkcc6DhPr9dfFsl3bjXy1wF5LU56RQXcYLXd58xtjKaak9HBaBP/sYuS6\nbpM/UaiiQeAxRzciXhzM7Ki2/mRV9ND2pGKFY02KPdljy1C16RDyetX5MVBbdgGi\n6KPs+U34t+h6zqEO7Hx03LBx/k0ZDWj8fKH/N/ZpMuAvAEwqkpMJXEK7/uA0F/zE\nSO/jivgOWQVX5sJnJWzfVS2RsFFwMI4uYh060SJRjX0o6kwupp3xlMe2UXhaqpML\nsQIDAQAB\n-----END PUBLIC KEY-----\n"},"summary":"astrids Blog","url":"https://dimna.de","publishedDate":"2017-04-05T00:00:00Z","icon":{"type":"Image","mediaType":"image/png","url":"https://dimna.de/activity-pub-icon.png"}}';
header('Content-Type: application/json; charset=utf-8');
echo $data;

In Curl everything looks good.

$ curl -X POST https://dimna.de/.well-known/webfinger/
{"subject":"acct:astrid@dimna.de","aliases":["https://dimna.de/user/astrid"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://dimna.de"},{"rel":"self","type":"application/activity+json","href":"https://dimna.de/user/astrid"}]}

and

$ curl -X POST https://dimna.de/user/astrid/
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1"],"id":"https://dimna.de/user/astrid","type":"Person","preferredUsername":"astrid","name":"dimna.de Blog","manuallyApprovesFollowers":false,"discoverable":true,"inbox":"https://dimna.de/user/astrid/inbox","outbox":"https://dimna.de/user/astrid/outbox","following":"https://dimna.de/user/astrid/following","followers":"https://dimna.de/user/astrid/followers","publicKey":{"id":"https://dimna.de/user/astrid#main","owner":"https://dimna.de/user/astrid","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvnJTfuyEgHxTs0UMR0Ee\n2rafvlfQDM+2RTRCAGnZ+ryBrLFBrk7oyIYDKe5ZKkJ2am8N2Y4Z958YppWOaWv+\nSzkqn/0Hkcc6DhPr9dfFsl3bjXy1wF5LU56RQXcYLXd58xtjKaak9HBaBP/sYuS6\nbpM/UaiiQeAxRzciXhzM7Ki2/mRV9ND2pGKFY02KPdljy1C16RDyetX5MVBbdgGi\n6KPs+U34t+h6zqEO7Hx03LBx/k0ZDWj8fKH/N/ZpMuAvAEwqkpMJXEK7/uA0F/zE\nSO/jivgOWQVX5sJnJWzfVS2RsFFwMI4uYh060SJRjX0o6kwupp3xlMe2UXhaqpML\nsQIDAQAB\n-----END PUBLIC KEY-----\n"},"summary":"astrids Blog","url":"https://dimna.de","publishedDate":"2017-04-05T00:00:00Z","icon":{"type":"Image","mediaType":"image/png","url":"https://dimna.de/activity-pub-icon.png"}}

In Mastodon the profile is shown to me when I enter my handel @astrid@dimna.de

However, the profil http://dimna.de/user/astrid/ is not found.

If I understand it correctly so far, the latter is the better test and I should make sure of that before I go any further. What am I missing?

I guess alias https://astrid.de/user/astrid is wrong in

$  curl -L 'https://dimna.de/.well-known/webfinger?resource=acct:astrid@dimna.de' | jq .
{
  "subject": "acct:astrid@dimna.de",
  "aliases": [
    "https://astrid.de/user/astrid"
  ],
  "links": [
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "type": "text/html",
      "href": "https://dimna.de"
    },
    {
      "rel": "self",
      "type": "application/activity+json",
      "href": "https://dimna.de/user/astrid"
    }
  ]
}
1 Like

The first thing I noticed is that you’re POSTing when I think you want to use a GET to retrieve stuff.

Second thing I noticed is that webfinger is usually called with a ‘resource’ parameter which is set to the thing you want to look up. This is how your profile is going to be fetched from other fediverse services.

The third thing is that when you fetch (GET) an ActivityPub entity, you’ll generally need to set your Accept: header to ‘application/ld+json; profile=“\https://www.w3.org/ns/activitystreams”’ as required by ActivityPub. Leave out the backslash. I need that to get the url past the markdown editor’s previewer.

1 Like

Your content-type is incorrect. This needs to be either application/activity+json or application/ld+json; profile=“https://www.w3.org/ns/activitystreams" as @macgirvin mentioned. (charset optional, I think all ActivityStreams 2.0 documents are implicitly utf-8 but don’t quote me on that).

1 Like

Thank you so much to all three of you.

@mro
It was not because of the alias. My guess: You are allowed to write it wrong, if it is not used as resource. From you I have picked up the tool jq. My hope: With this tool I will find such Copy&Past errors in the future.

@nightpool @macgirvin
It was due to the wrong content type. After I changed it, my profile http://dimna.de/user/astrid/ was found in Mastodon instances.

I felt safe with my wrong Content-Type, because my handel @astrid@dimna.de was found. Now I did some research and found here that Webfinger is probably not that strict: Problems POSTing to Mastodon inbox - #14 by nightpool

I haven’t quite understood that yet. But now that it works, I’m curious to see how I get on.

1 Like