Want to build an ActivityPub client; where to start?

I’d like to build an ActivityPub client, but to start off I feel that I need to define a Minimum Viable Product. What’s the absolute minimum a client needs, in order to follow an Actor and receive posts? Do I need to start by implementing OAuth2?

1 Like

Hi @tinyrabbit I had the same question almost two years ago, and this is what I composed:


You could use #software:andstatus app as a debugging tool, at least… :slight_smile:
1 Like

My client will be web-based, which poses a kinnda weird (to me, at least) situation: it should itself be protected by a login, while also logging in to one or more servers…

Maybe I’m being impractical here. What I want to do is a frontend, but I assumed that a frontend would be the same thing as a client if it’s going to be compatible with several backends. I may be mistaken there.

But I take it the OAuth thing is pretty much the first thing I need to implement either way…

Regarding OAuth I agree, you can do nothing before you successfully authenticated at a server.

I also think that Web-based client (even if it’s a “frontend” of a collocated ActivtyPub server) should ideally use the same interface to the server as any other client app.
So authentication on the Web client can be unrelated to authentication on the ActivtyPub server. Just like we unlock smartphone in order to use mobile device-based client app that, in its turn, authenticates at several ActivtyPub servers in a different way…

If OAuth sounds quite complex to you, you could start with HTTP Basic (Pleroma supports both) at first just to test that the rest will be working but I wouldn’t use HTTP Basic other than for testing/debugging if you store tokens.

As for storing tokens on the client side, you could use the LocalStorage API if you use JavaScript.

Please note that “Web-based” client doesn’t necessarily mean that the client cannot have its own server-side, including server-side (“cloud-based”) storage…
Moreover, having such a server-side will allow to reuse a lot of existing code of client apps. Literally! Just add to it an embedded http server for Web access…

This could also be not only JVM-running code (in Java or Kotlin) that Android Open Source apps use, but also a native Linux app compiled e.g. using Kotlin native. Why not, if you are creating a new app?!

Thanks for the replies, everyone :slight_smile:

I’ve taken stock of my limited time and way too limited web dev experience and changed the focus of this. It’s gonna be some time before I make noticeable progress, I’m afraid :smile:

Hi, I would like to share the effort and start building a basic AP client as well. Is there a list of AP servers that support the Client-to-Server API of AP?

I was going through the list at https://activitypub.rocks/implementation-report/, but obviously that list is old, since you mention that Pleroma does support it. I want to use Angular, without my server if possible.

2 Likes

I’m pretty sure Pleroma supports the C2S part of the protocol. I think their front-end uses it, for example.

Actually, what’s your intended time frame on this?

I changed my scope to write a server instead of a client, because I realized I’m more comfortable on the backend. My pace is slow. I’ve implemented webfinger (still looking at the Actor Object and figuring out what I want in it) so far. Next step is HTTP signatures, so I can start communicating with the rest of the fediverse. After that comes inboxes, I guess.

Within a couple of weeks I’ll need to make my server publicly accessible on one domain or other. If you want to create a client one feature at a time we could work in tandem. You make the client calls, I’ll make the server responses.

When you say you want to work “without [your] server if possible”, do you mean that you’d like your software hosted somewhere else during development?

Actually, what’s your intended time frame on this?

I intend to have some working version within 2 months. I can iterate later on.

webfinger… HTTP signatures, so I can start communicating with the rest of the fediverse

I am bit afraid of those, as I don’t have any experience with it.

Within a couple of weeks I’ll need to make my server publicly accessible on one domain or other. If you want to create a client one feature at a time we could work in tandem. You make the client calls, I’ll make the server responses.

That sounds good, we can work together. However my idea is that the client should be working with any AP server, so I can communicate with e.g. Pleroma and Mastodon.

When you say you want to work “without [your] server if possible”, do you mean that you’d like your software hosted somewhere else during development?

I’d like to start developing on localhost and then it could be served on e.g. heroku (like inbox-client.herokuapp.com). Since angular is just JS, it can be just basic http server hosting.

I’m pretty sure Pleroma supports the C2S part of the protocol. I think their front-end uses it, for example.

I cannot find in the docs though: https://docs-develop.pleroma.social/backend/API/pleroma_api/ or am I just blind?

I don’t think the Pleroma FE uses C2S, but the backend supports it to some degree. Not sure if it’s mentioned in the docs anywhere

I don’t think the Pleroma FE uses C2S, but the backend supports it to some degree. Not sure if it’s mentioned in the docs anywhere

I cannot find it. But @yvolk has built “Basic implementation of “client to server” ActivityPub protocol” and “tested it against Pleroma” : https://github.com/andstatus/andstatus/issues/499

I hacked together a simple example here: https://gitlab.com/vpzomtrrfrt/c2sdemo

1 Like

Pleroma provides AP C2S, it doesn’t have any application/frontend other than AndStatus (which sadly I don’t use as I don’t have android).

I’m slowly building a Qt/QML application (QtMobile-oriented but should work fine on desktop as well) that does AP C2S, yet to publish it as I’d rather freely experiment with the design of it before doing that.

As for the documentation, it’s quite WIP and we don’t have much things other than:

3 Likes

Wow, that was quick, thank you!

However, I am sorry but I don’t understand how to use it. What should go to the login? From the source code I think it should be some kind of URL with login? I tried bunch of stuff, but didn’t figure it out.

The URL is the ActivityPub ID of the user, in my case it was https://greenish.red/users/vpzom

A real implementation would probably want to allow webfinger

Thanks, I’m getting further. When I try yours, it works.
Now I tried Pleroma “https://pleroma.site/nokton”, that response “To use Pleroma, please enable JavaScript.” So I tried https://toot.whatever.cz/@nokton, there I have a better success as I receive the profile’s JSON, however it does not have the OAuth reg. endpoint defined. In your code:

const regEndpoint = user.endpoints.oauthRegistrationEndpoint;

And my JSON:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
...
  "endpoints": {
    "sharedInbox": "https://toot.whatever.cz/inbox"
  }

Now, I tried it with the “user” path: https://greenish.red/users/nokton and finally I got it!

So thank you very much, now I’ll be working on replicating this in my app.

toot.whatever.cz looks like a mastodon instance, and I don’t think mastodon supports this

for pleroma, the /users part seems to be required

1 Like