Source code: https://pastebin.com/cCnnVA0d
(imports and declaration of some variables omitted).
When I execute that code I get 500 from Mastodon and 401 from Pleroma, I’m pretty sure lines 18-20 are at the fault here.
My server outputs this when sending GET requests to /users/admin (domain replaced with example.com ):
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://example.com/users/admin",
"name": "admin",
"type": "Person",
"inbox": "https://example.com/users/admin/inbox",
"liked": "https://example.com/users/admin/liked",
"outbox": "https://example.com/users/admin/outbox",
"followers": "https://example.com/users/admin/followers",
"following": "https://example.com/users/admin/following",
"publicKey": {
"id": "https://example.com/users/admin#main-key",
"owner": "https://example.com/users/admin",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq1PxyqkNEbeyRAIf7epP\n4IBPlcWIX6KV1E8IKzbWcNHAzw3f/e3ngUe9ny1R+72DZwnDU1BJ9DH2jKcLRN+G\nHGYaKLwfKthESe/gShdlLQGRMdoMTtI/QWP4RhK9opZ4Bs7WPUdvVPEzA6GaFFvs\nTeF0CTZOFBNZ7htIyYJe0UL3Anf4hsjzO+Y51BWfZrrQAXV6xlx/TWyHcaukkLmw\nQrBvyOiDmQjVtVVDvdVrFYjAt9+hjJBe645UKW0Wc03UydWFhs0evYFy9Rgp9kDr\nAAitRHCRp+PxXmw3bf/UThNTh4NCXGWRDJgYscnh17FZfCA/Le40kWvxTokXxpJ4\njQIDAQAB\n-----END PUBLIC KEY-----"
},
"preferredUsername": "admin"
}
What do I do?
vpzom
November 27, 2020, 3:52pm
2
I would suggest testing against a local instance so you can look at the logs, especially for a 500
cjs
November 27, 2020, 4:44pm
3
What is the output from https://test.activitypub.dev/ ?
It will basically spew logs at you so you don’t have to test against a local instance.
1 Like
What test do I need to do exactly? Server currently doesn’t have a lot of features, it doesn’t even have any way of creating objects, unless I hard code creation of some object like I did in that pastebin code (I do have a way of fetching objects, activities and actors through API though), so a lot of these tests don’t apply.
Without the digest header, Mastodon responds with non-500 status code and message that Digest header is required. As soon as I add that header, Mastodon starts responding with 500. The line 18 is probably at the fault here, I don’t really know how to generate hash correctly.
I tried generating digest header differently, didn’t work either.
grishka
November 28, 2020, 11:12pm
7
For one, you’re including the Digest
header into your signature, but not into the request itself.
1 Like
Thank you! Mastodon responds with 202 now that my server has Digest header in both signature and the request itself.
grishka
November 29, 2020, 1:58pm
9
Yeah that’s what it’s supposed to do. If you had a working inbox, you’d also receive an Accept{Follow}
activity shortly after.
I did receive Accept
actually, I have a console.log on inbox right now.